var comment=0;var comments=[];var threads=[];var user;var inlineApproveCount=0;var inlineReviseCount=0;var pendingCount=0;var pendingAnonCount=0;var hiddenCount=0;var reviseCount=0;var firstThreadRun=false;var firstApproveRun=false;var firstReviseRun=false;var threadListNode=null;var pendingListNode=null;var hidingListNode=null;var reviseListNode=null;var showTT=true;var flagDialog=false;var modalPanel=false;var whyDialog=false;var overlayContext=[];var baseComments=[];var pendAnim=null;var approveBox=false;var checkQueue=[];var checkCount=0;var currentCheck=0;var tabView;var cmOpenButton=false;var cmCloseButton=false;var cmAnonOnButton=false;var cmAnonOffButton=false;var cmSwOnButton=false;var cmSwOffButton=false;var cmAgeOnButton=false;var cmAgeOffButton=false;var cmCnOnButton=false;var cmCnOffButton=false;var Dom=YAHOO.util.Dom;function parseCheck(o){if(o.responseText.search("{")!==0){ajaxFail(o);return false}var data=YAHOO.lang.JSON.parse(o.responseText);if(data.error.length){notify(data.error)}else{if(data.notification.length){notify(data.notification)}}if(!data.autocancel&&!data.error.length&&data.modal.length){modal(data.modal,data.count)}else{if(!data.autocancel&&!data.error.length&&data.modal.length<1){eval(checkQueue[data.count]+"();")}}}function Comment(a){this.state="shrink";this.searched=false;this.large=false;this.exModNode=false;this.mode="thread";this.inlineModNode=false;this.loadData=function(b){this.id=b.id;this.content=unescape(b.content);this.authorID=b.authorID;this.authorName=b.authorName;this.made=b.made;this.madestamp=b.madestamp;this.parentID=b.parentID;this.threadID=b.threadID;this.status=b.status;this.flagged=b.flagged;this.hidingflag=b.hidingflag;this.hidingRemark=b.hidingRemark;this.mode=b.mode;this.masked=b.masked;this.age=b.age;if(b.reply){this.reply=b.reply;this.lastReply=this.reply[this.reply.length-1]}else{this.reply=[]}if(b.award){this.award=b.award}else{this.award=[]}this.power=b.power};this.loadData(a);this.setStatus=function(b){this.status=b;if(this.status=="hidden"||this.status=="pending"||(this.status=="deferred"&&this.mode=="thread")||(this.status=="revise"&&this.mode=="thread")||this.status=="revised"){this.ghost(true)}else{this.ghost(false)}};this.addReply=function(b){cNode=b.getNode();if(cNode){this.getSubNode().appendChild(cNode)}};this.insert=function(){if(this.node){return false}if(this.mode=="thread"&&this.parentID&&comments[this.parentID]){pNode=comments[this.parentID].getSubNode();YAHOO.util.Dom.removeClass(comments[this.parentID].node,"cm_noreply");YAHOO.util.Dom.addClass(comments[this.parentID].node,"cm_hasreply")}else{if(this.mode=="thread"&&threads[this.threadID]){pNode=threadListNode}else{if(this.mode=="approve"&&(this.status=="pending"||this.status=="revised")&&pendingListNode){pNode=pendingListNode}else{if(this.mode=="approve"&&this.status=="hidden"&&hidingListNode){pNode=hidingListNode}else{if(this.mode=="revise"&&this.status=="revise"&&reviseListNode){pNode=reviseListNode}}}}}this.node=this.getNode();pNode.appendChild(this.node);if(this.mode=="thread"){if(this.authorID!=config.userID){this.giveAward("new");YAHOO.util.Dom.addClass(this.node,"new")}YAHOO.util.Dom.addClass(this.node,"cm_end");sibNode=YAHOO.util.Dom.getPreviousSibling(this.node);YAHOO.util.Dom.removeClass(sibNode,"cm_end");showThread()}};this.flag=function(d){if(tt){tt.hide()}if(this.inlineModNode){ttClean(this.inlineModNode)}if(!config.userID){return 0}this.flagged=d;var c=document.createElement("span");YAHOO.util.Dom.addClass(c,"expander");desText=document.createElement("span");c.appendChild(desText);desText.appendChild(document.createTextNode("you said "));flag=flags[this.flagged];var b=flag.spawnIcon(this.id);contextElements.push(b.id);desText.appendChild(b);if(!flags[d].parent){YAHOO.util.Event.addListener(desText,"click",whyFlag,[this.id,flag.id,false])}if(this.inlineModNode){this.inlineModNode.parentNode.replaceChild(c,this.inlineModNode)}else{this.divNode.appendChild(c)}this.inlineModNode=c;if(this.inlineModNode){ieBracket(this.inlineModNode,true)}};this.expandMod=function(){if(this.exModNode){if(this.exModNode.style.display=="inline"){YAHOO.util.Dom.setStyle(this.exModNode,"visibility","hidden");this.exModNode.style.display="none"}else{YAHOO.util.Dom.setStyle(this.exModNode,"visibility","inherit");this.exModNode.style.display="inline";var c=YAHOO.util.Dom.getElementsByClassName("cm_bw","img",this.inlineModNode);for(var b in c){if(c[b].id.indexOf("flag")!=-1){c[b].style.display="none";YAHOO.util.Dom.setStyle(c[b],"visibility","hidden")}else{YAHOO.util.Dom.removeClass(c[b],"cm_bw")}}}}};this.unflag=function(){if(tt){tt.hide()}if(this.inlineModNode){ttClean(this.inlineModNode)}if(!config.userID){return 0}this.flagged=false;this.refreshMod()};this.hide=function(d){if(tt){tt.hide()}this.removeMod();if(this.reply.length&&config.view=="thread"){for(var b in this.reply){comments[this.reply[b]].hide(false)}}if(d){var c={height:{to:0}};var e=YAHOO.util.Dom.getRegion(this.node);var g=(e.bottom-e.top)/280;if(g<0.8){g=0.8}var f=new YAHOO.util.Anim(this.node,c,g);if(this.mode=="thread"&&this.parentID){f.onComplete.subscribe(removeChild,this)}else{f.onComplete.subscribe(removeBaseComment,this)}f.animate()}else{YAHOO.util.Dom.setStyle(this.node,"display","none");comments[this.parentID].removeChild(this.id)}YAHOO.util.Dom.setStyle(this.node,"visibility","hidden");if(this.mode=="thread"&&(this.status=="hidden"||this.status=="pending"||this.status=="deferred"||this.status=="revised")){inlineApproveCount--}else{if(this.mode=="approve"&&(this.status=="pending"||this.status=="deferred"||this.status=="revised")){pendingCount--;if(!this.authorID){pendingAnonCount--}checkForApproveHide()}else{if(this.mode=="approve"&&this.status=="hidden"){hiddenCount--;checkForApproveHide()}else{if(this.mode=="thread"&&this.status=="revise"&&this.authorID==config.userID){inlineReviseCount--}else{if(this.mode=="revise"&&this.status=="revise"&&this.authorID==config.userID){reviseCount--;if(reviseCount<1){hideRevise()}}}}}}};this.removeChild=function(d){if(this.reply.length<2){this.reply=[];this.lastReply=false;YAHOO.util.Dom.removeClass(this.node,"cm_hasreply");YAHOO.util.Dom.addClass(this.node,"cm_noreply");if(this.subNode){this.node.removeChild(this.subNode)}}else{var c=[];for(var b in this.reply){if(this.reply[b]!=d){c.push(this.reply[b])}else{this.subNode.removeChild(comments[this.reply[b]].node)}}this.reply=c;this.lastReply=this.reply[this.reply.length-1];YAHOO.util.Dom.addClass(comments[this.lastReply].getNode(),"cm_end")}};this.approve=function(){if(this.mode=="approve"){this.hide(true);return true}if(this.remarkSpan){this.divNode.removeChild(this.remarkSpan)}this.setStatus("approved");this.flagged=null;this.showReply();this.refreshMod();if(this.mode=="thread"){inlineApproveCount--}};this.showReply=function(){if(view!="thread"){return false}if((threads[this.threadID].anonymous||config.userID)&&!threads[this.threadID].closed&&(this.status=="approved"||this.status=="auto-approved")){YAHOO.util.Dom.setStyle(this.replyButtonNode,"display","inline");YAHOO.util.Dom.setStyle(this.replyButtonNode,"visibility","inherit")}};this.hideReply=function(){if(this.replyButtonNode){YAHOO.util.Dom.setStyle(this.replyButtonNode,"display","none");YAHOO.util.Dom.setStyle(this.replyButtonNode,"visibility","hidden")}};this.removeMod=function(){if(this.inlineModNode){ttClean(this.inlineModNode)}return true};this.getNode=function(){this.sortReplies(false);if(this.reply.length){this.lastReply=this.reply[this.reply.length-1]}else{this.lastReply=false}if(this.mode=="thread"){if(!threads[this.threadID].codename){this.masked=false}if(this.status=="censored"||this.status=="rejected"){return null}if((this.status=="pending"||this.status=="deferred"||this.status=="hidden"||this.status=="revised")&&threads[this.threadID].ownerID!=config.userID&&!config.isAdmin){return null}if(this.status=="hidden"&&this.flagged==this.hidingflag){return null}}var c=false;if(this.node){c=true}else{this.node=document.getElementById("cm-"+this.id);if(this.node){this.node.parentNode.removeChild(this.node)}this.node=document.createElement("li")}if(this.mode=="thread"&&this.parentID){if(!comments[this.parentID]){return null}if(this.id==comments[this.parentID].lastReply){YAHOO.util.Dom.addClass(this.node,"cm_end")}else{YAHOO.util.Dom.removeClass(this.node,"cm_end")}}if(c){return this.node}this.node.setAttribute("id","cm-"+this.id);YAHOO.util.Dom.addClass(this.node,"cm_comment");this.divNode=document.createElement("div");YAHOO.util.Dom.addClass(this.divNode,"cm_comment_div");YAHOO.util.Dom.addClass(this.divNode,"cm_age_"+this.age);this.node.appendChild(this.divNode);if(this.mode=="revise"){briefNode=document.createElement("div");briefNode.appendChild(document.createTextNode("Please revise or delete this comment for the following reason:"));this.divNode.appendChild(briefNode);remarkNode=document.createElement("div");YAHOO.util.Dom.setStyle(remarkNode,"color","#771111");remarkNode.appendChild(document.createTextNode(this.hidingRemark));this.divNode.appendChild(remarkNode)}if(this.mode!="revise"){showColon=true;if(this.mode!="thread"){showColon=false}var j=false;if(this.mode=="thread"){if(threads[this.threadID].orgid!=users[this.authorID].orgid){j=true}}if(this.masked||this.mode=="approve"){this.byNode=getCodenameSpan(users[this.authorID].colorName,users[this.authorID].animal,users[this.authorID].colorHex,showColon,j)}else{var n=users[this.authorID].name;if(!n){n=this.authorName}this.byNode=getCodenameSpan(n,"","000000",showColon,j)}if(this.mode=="approve"&&config.isRoot&&this.authorID){var f=document.createElement("a");f.setAttribute("target","_blank");f.setAttribute("href","/modules/comment/profile.phtml?uid="+this.authorID+"&sessionid="+sessionid);f.appendChild(this.byNode);this.divNode.appendChild(f)}else{this.divNode.appendChild(this.byNode)}if(this.mode=="thread"){if(!this.masked&&this.authorID==threads[this.threadID].ownerID){this.byNode.title=this.made}else{if(this.authorID&&this.authorID==config.userID){this.byNode.title="By me on "+this.made}else{if(users[this.authorID].id){var p="By "+users[this.authorID].tooltipText(config.isAdmin||config.isThreadOwner);p+="<br/>On "+this.made;if(j){p+="<br/>* - From another school"}this.byNode.title=p;this.byNode.id="cm_authorname_"+this.id;contextElements.push(this.byNode.id)}}}}else{if((config.isRoot||config.approveMode!="random")&&(config.isAdmin||config.isThreadOwner)&&users[this.authorID].id&&users[this.authorID].id!=config.userID){realNameNode=document.createElement("span");YAHOO.util.Dom.addClass(realNameNode,"admin_link");if(users[this.authorID].name){realNameNode.appendChild(document.createTextNode(" ("+users[this.authorID].name+")"))}else{realNameNode.appendChild(document.createTextNode(" ("+this.authorName+")"))}this.divNode.appendChild(realNameNode)}}if(this.mode!="thread"){dateNode=document.createElement("span");dateNode.appendChild(document.createTextNode(" on "+this.made+" "));this.divNode.appendChild(dateNode);if(this.mode=="revise"){this.divNode.appendChild(document.createElement("br"))}else{this.divNode.appendChild(document.createElement("hr"))}}}var m="";this.expText="";if(this.mode=="thread"){var k=0;average_line*=1;power_line_factor*=1;if(this.power*power_line_factor>average_line){base_lines+=1}var o=0;lines=this.content.split("\n");for(k in lines){o+=Math.ceil(lines[k].length/average_line)}if(o>base_lines){this.large=true;var h=base_lines;for(k in lines){var l=Math.ceil(lines[k].length/average_line);if(h<=0){this.expText+=lines[k];if(k<lines.length-1){this.expText+="\n"}}else{if(l>h){sliceTo=lines[k].indexOf(" ",Math.floor(h*average_line))+1;if(!sliceTo){sliceTo=lines[k].length}m+=lines[k].substr(0,sliceTo);this.expText=lines[k].substr(sliceTo);if(k<lines.length-1){this.expText+="\n"}h-=l;if(this.expText.length<lines_gimme){m=this.content;this.large=false}}else{m+=lines[k];if(k<lines.length-1){m+="\n"}h-=l}}}this.abbrevText=m}else{m=this.content}}else{m=this.content}if(this.mode=="revise"){this.contentNode=document.createElement("textarea");this.contentNode.setAttribute("cols",58);this.contentNode.setAttribute("rows",8)}else{this.contentNode=document.createElement("span")}this.contentNode.id="cm_content-"+this.id;YAHOO.util.Dom.addClass(this.contentNode,"cm_base_content");wikiParse(m,this.contentNode);this.divNode.appendChild(this.contentNode);if(this.large){this.expander=document.createElement("span");YAHOO.util.Event.addListener(this.expander,"click",this.grow,this,true);YAHOO.util.Dom.addClass(this.expander,"slider");this.expander.appendChild(document.createTextNode(">>> "));this.contentNode.appendChild(this.expander);this.expNode=document.createElement("span");this.expNode.id="cm_exp_content-"+this.id;YAHOO.util.Dom.addClass(this.expNode,"cm_exp_content");wikiParse(this.expText,this.expNode);this.shrinker=document.createElement("span");YAHOO.util.Event.addListener(this.shrinker,"click",this.shrink,this,true);YAHOO.util.Dom.addClass(this.shrinker,"slider");this.shrinker.appendChild(document.createTextNode(" <<< "));this.expNode.appendChild(this.shrinker);this.divNode.appendChild(this.expNode)}this.awardNode=document.createElement("span");if(this.mode!="approve"||this.award.length){YAHOO.util.Dom.addClass(this.awardNode,"cm_award_row")}if(this.award.length){for(var g in this.award){this.giveAward(this.award[g])}}this.divNode.appendChild(this.awardNode);if(this.hidingRemark){this.remarkSpan=document.createElement("span");if(this.mode!="thread"){this.remarkSpan.appendChild(document.createElement("hr"))}else{this.remarkSpan.appendChild(document.createElement("br"))}if(this.mode!="revise"){sNode=document.createElement("span");YAHOO.util.Dom.setStyle(sNode,"font-weight","bold");if(this.status=="revised"){rText="Reviewer: "}else{if(this.status=="hidden"){rText="Reviewer: "}else{rText="Reviewer: "}}sNode.appendChild(document.createTextNode(rText));this.remarkSpan.appendChild(sNode);this.remarkSpan.appendChild(document.createTextNode(this.hidingRemark));this.divNode.appendChild(this.remarkSpan)}}if(this.mode!="thread"){this.divNode.appendChild(document.createElement("hr"))}if(this.status=="revise"&&this.authorID==config.userID){this.reviseButtonNode=document.createElement("a");this.reviseButtonNode.appendChild(document.createTextNode("revise"));if(this.mode=="thread"){YAHOO.util.Dom.addClass(this.reviseButtonNode,"expander");this.reviseButtonNode.setAttribute("href","javascript:openRevise("+this.id+");");this.divNode.appendChild(this.reviseButtonNode);ieBracket(this.reviseButtonNode,true)}else{YAHOO.util.Dom.addClass(this.reviseButtonNode,"button");this.reviseButtonNode.setAttribute("href","javascript:sendFlatRevise("+this.id+");");this.divNode.appendChild(this.reviseButtonNode);this.deleteButtonNode=document.createElement("a");this.deleteButtonNode.appendChild(document.createTextNode("delete"));YAHOO.util.Dom.addClass(this.deleteButtonNode,"button");this.deleteButtonNode.setAttribute("href","javascript:deleteComment("+this.id+");");this.divNode.appendChild(this.deleteButtonNode)}}if(this.mode=="thread"&&!threads[config.thread].closed){this.replyButtonNode=document.createElement("a");YAHOO.util.Dom.addClass(this.replyButtonNode,"expander");this.replyButtonNode.appendChild(document.createTextNode("reply"));this.replyButtonNode.setAttribute("href","javascript:openReply("+this.id+");");this.divNode.appendChild(this.replyButtonNode);ieBracket(this.replyButtonNode,true);if((!threads[this.threadID].anonymous&&!config.userID)||(this.status!="approved"&&this.status!="auto-approved")){YAHOO.util.Dom.setStyle(this.replyButtonNode,"display","none");YAHOO.util.Dom.setStyle(this.replyButtonNode,"visibility","hidden")}}this.divNode.appendChild(document.createTextNode(" "));this.refreshMod();if(config.isRoot&&this.mode=="approve"){var b=document.createElement("button");b.appendChild(document.createTextNode("See in context"));YAHOO.util.Event.addListener(b,"click",geturl,this,true);YAHOO.util.Dom.insertAfter(b,this.inlineModNode)}if(this.mode=="thread"&&this.reply.length){YAHOO.util.Dom.addClass(this.node,"cm_hasreply");for(var i in this.reply){this.addReply(comments[this.reply[i]])}}else{YAHOO.util.Dom.addClass(this.node,"cm_noreply")}this.setStatus(this.status);return this.node};this.refreshMod=function(){if(this.authorID==config.userID||(this.mode=="thread"&&threads[this.threadID].closed)||!config.userID||(this.status=="revise"&&this.authorID!=config.userID)||(!this.masked&&!config.isMod)||(this.mode=="approve"&&this.status!="hidden"&&this.status!="pending"&&this.status!="deferred"&&this.status!="revised")){if(this.inlineModNode){ttClean(this.inlineModNode);this.inlineModNode.parentNode.removeChild(this.inlineModNode);this.inlineModNode=false}return false}if(this.inlineModNode){ttClean(this.inlineModNode);while(this.inlineModNode.hasChildNodes()){this.inlineModNode.removeChild(this.inlineModNode.firstChild)}}else{this.inlineModNode=document.createElement("span");YAHOO.util.Dom.addClass(this.inlineModNode,"expander");var c=false;if(this.replyButtonNode){c=this.replyButtonNode;YAHOO.util.Dom.insertAfter(this.inlineModNode,c)}else{this.divNode.appendChild(this.inlineModNode)}}var d=false;var b=0;switch(this.status){case"revised":case"pending":case"deferred":d=spawnIcon("approve",this.id);contextElements.push(d.id);YAHOO.util.Event.addListener(d,"click",approve,this,true);this.inlineModNode.appendChild(d);d=spawnIcon("reject",this.id);contextElements.push(d.id);YAHOO.util.Event.addListener(d,"click",reject,this,true);this.inlineModNode.appendChild(d);if(this.status=="pending"&&this.mode!="thread"){d=spawnIcon("deferred",this.id);contextElements.push(d.id);YAHOO.util.Event.addListener(d,"click",defer,this,true);this.inlineModNode.appendChild(d)}for(b in flags){if(flags[b].hides&&flags[b].hides!="false"){if(flags[b].revises&&(!this.authorID||!config.isMod||this.status=="revised")){continue}d=flags[b].spawnIcon(this.id);YAHOO.util.Event.addListener(d,"click",addFlag,[this.id,flags[b].id]);this.inlineModNode.appendChild(d);contextElements.push(d.id)}}break;case"hidden":flag=flags[this.hidingflag];d=flag.spawnText(this.id);this.inlineModNode.appendChild(d);contextElements.push(d.id);this.inlineModNode.appendChild(document.createTextNode("? "));d=spawnIcon("agree",this.id,flag);contextElements.push(d.id);YAHOO.util.Event.addListener(d,"click",censor,this.id);this.inlineModNode.appendChild(d);d=spawnIcon("disagree",this.id,flag);contextElements.push(d.id);YAHOO.util.Event.addListener(d,"click",dismiss,this.id);this.inlineModNode.appendChild(d);if(!flags[this.hidingflag].revises&&this.authorID){d=flags[16].spawnIcon(this.id);contextElements.push(d.id);YAHOO.util.Event.addListener(d,"click",revise,this.id);this.inlineModNode.appendChild(d)}break;case"approved":case"auto-approved":if(this.flagged){this.flag(this.flagged);break}if(view!="thread"){break}for(b in flags){if(flags[b].id==16&&(!config.isMod||!config.canHide||!this.authorID)){continue}if(flags[b].hides&&!config.canHide){continue}if(!flags[b].parent){d=flags[b].spawnIcon(this.id,true);if(flags[b].id<=2){YAHOO.util.Event.addListener(d,"click",whyFlag,[this.id,flags[b].id,true])}else{YAHOO.util.Event.addListener(d,"click",addFlag,[this.id,flags[b].id])}this.inlineModNode.appendChild(d);contextElements.push(d.id)}}YAHOO.util.Event.addListener(this.inlineModNode,"mouseover",colorizeChildren,this.inlineModNode);YAHOO.util.Event.addListener(this.inlineModNode,"mouseout",decolorizeChildren,this.inlineModNode);break}if(this.mode!="approve"&&(!this.flagged||this.status=="revised")&&this.inlineModNode){ieBracket(this.inlineModNode,true)}return this.inlineModNode};this.blockContent=function(){var b=window.getSelection();var d="|!"+b+"!|";var c=getRangeObject(b);c.deleteContents();c.insertNode(document.createTextNode(d));var e="";while(this.contentNode.hasChildNodes()){if(this.contentNode.firstChild.data){e+=this.contentNode.firstChild.data}this.contentNode.removeChild(this.contentNode.firstChild)}wikiParse(e,this.contentNode)};this.giveAward=function(c){if(c=="revise"){return false}var b=false;if(c=="new"||c=="hidden"||c=="pending"||c=="revised"||c=="deferred"){b=spawnIcon(c,"a"+this.id)}else{flag=flags[c.flag];b=flag.spawnIcon("a"+this.id)}contextElements.push(b.id);this.awardNode.appendChild(b);return b};this.ghost=function(b){if(b){if(this.status!="pending"){this.ghostNode=this.giveAward(this.status)}YAHOO.util.Dom.addClass(this.divNode,"ghost");if(this.mode=="thread"){YAHOO.util.Dom.setStyle(this.divNode,"background-color","#ffffcc")}this.grow()}else{if(this.mode=="thread"){if(this.ghostNode){var c={backgroundColor:{to:"#ffffff"}};var d=new YAHOO.util.ColorAnim(this.divNode,c,2.5);d.animate();this.ghostNode.parentNode.removeChild(this.ghostNode);this.ghostNode=0}else{YAHOO.util.Dom.setStyle(this.divNode,"background-color","transparent")}}YAHOO.util.Dom.removeClass(this.divNode,"ghost")}};this.shrink=function(){this.state="shrink";if(YAHOO.env.ua.ie&&YAHOO.env.ua.ie<8){var b=YAHOO.util.Dom.get("cm_holder");b.appendChild(this.shrinker);this.contentNode.innerHTML="";wikiParse(this.abbrevText,this.contentNode);this.contentNode.appendChild(this.expander);return}if(this.expText.length>=noanim_limit){this.finishShrink();return}var c={opacity:{to:0}};var d=new YAHOO.util.Anim(this.expNode,c,0.6,YAHOO.util.Easing.easeIn);d.onComplete.subscribe(this.finishShrink,this,true);d.animate()};this.finishShrink=function(){YAHOO.util.Dom.setStyle(this.expNode,"visibility","hidden");YAHOO.util.Dom.setStyle(this.expNode,"display","none");YAHOO.util.Dom.setStyle(this.expander,"visibility","inherit");YAHOO.util.Dom.setStyle(this.expander,"display","inline")};this.grow=function(){this.state="grow";if(YAHOO.env.ua.ie&&YAHOO.env.ua.ie<8){var b=YAHOO.util.Dom.get("cm_holder");if(this.expander){b.appendChild(this.expander)}this.contentNode.innerHTML="";wikiParse(this.content,this.contentNode);if(this.shrinker){this.contentNode.appendChild(this.shrinker)}return}YAHOO.util.Dom.setStyle(this.expNode,"visibility","inherit");YAHOO.util.Dom.setStyle(this.expNode,"display","inline");YAHOO.util.Dom.setStyle(this.expander,"visibility","hidden");YAHOO.util.Dom.setStyle(this.expander,"display","none");if(this.expText.length>=noanim_limit){YAHOO.util.Dom.setStyle(this.expNode,"opacity",1)}else{YAHOO.util.Dom.setStyle(this.expNode,"opacity",0);var c={opacity:{to:1}};var d=new YAHOO.util.Anim(this.expNode,c,1,YAHOO.util.Easing.easeOut);d.animate()}};this.getSubNode=function(){if(!this.subNode){this.subNode=document.createElement("ul");this.node.appendChild(this.subNode)}return this.subNode};this.fillRevise=function(){var b=YAHOO.util.Dom.get("reviseRemark");while(b.hasChildNodes()){b.removeChild(b.firstChild)}tNode=YAHOO.util.Dom.get("reviseContent");tNode.value=this.content};this.sortReplies=function(c){var b=0;var d=[];for(b in this.reply){if(comments[this.reply[b]]){d.push(this.reply[b])}}this.reply=sortCommentList(d);if(c){for(b in this.reply){this.reply[b].sortReplies(true)}}};this.reorderReplies=function(c){if(this.reply.length<2){return true}subNode=this.getSubNode();if(!subNode.hasChildNodes()){return true}for(var b in this.reply){subNode.removeChild(comments[this.reply[b]].getNode())}for(var b in this.reply){subNode.appendChild(comments[this.reply[b]].getNode());if(c){this.reply[b].reorderReplies(true)}}};this.search=function(b){if(this.content.search("/"+b+"/i")){this.openSearch(b)}else{if(this.searched){this.closeSearch()}}};this.openSearch=function(b){this.searched=true;this.grow();this.searchResultNode=document.createElement("div");YAHOO.util.Dom.addClass(this.searchResultNode,"cm_content");wikiParse(this.content,this.searchResultNode,b);this.node.replaceChild(this.searchResultNode,this.conNode)};this.closeSearch=function(){this.searched=false;this.node.replaceChild(this.conNode,this.searchResultNode);this.node.removeChild(this.searchResultNode);this.searchResultNode=false;if(this.state=="grow"){this.grow()}else{this.shrink()}}}function processReport(b){var a=YAHOO.util.Dom.get("thread_report");a.innerHTML=b.responseText}function openWindow(a,b){if(b){window.open(a,"threadWindow")}else{notify(["<a target='_blank' href='"+a+"'>Go to thread</a>"])}}function parseJSON(c){if(c.responseText.search("{")!==0){ajaxFail(c);return false}var g=YAHOO.lang.JSON.parse(c.responseText);if(g.config){if(config&&config.userID&&config.userID!=g.config.userID){window.location.reload(true)}config=g.config;if(!config.userID){config.userID=0}if(config.approveMode&&config.approveMode=="none"){firstApproveRun=false}}if(g.user){parseUsers(g.user)}if(g.flag){parseFlags(g.flag)}if(g.userflag){parseUserFlags(g.userflag)}if(g.thread){for(var j in g.thread){threads[g.thread[j].id]=new Thread(g.thread[j])}}if(g.comment){parseComments(g.comment)}if(g.error.length){notify(g.error)}else{if(g.notification.length||inNotes.length){notify(g.notification.concat(inNotes));inNotes=[]}}var e="";if(firstThreadRun&&pendingListNode&&view!="approve"){e="/modules/comment/data.php?return=json&view=approve&newload=true&noFlags=true&numApproves="+numApproves+"&threadExclude="+thread+"&sessionid="+sessionid;YAHOO.util.Connect.asyncRequest("GET",e,callback);firstApproveRun=true}if(firstThreadRun&&reviseListNode&&view!="revise"){e="/modules/comment/data.php?return=json&view=revise&newload=true&noFlags=true&threadExclude="+thread+"&sessionid="+sessionid;YAHOO.util.Connect.asyncRequest("GET",e,callback);firstReviseRun=true}if(firstThreadRun||firstApproveRun||firstReviseRun){for(var j in g.comment){var i=comments[g.comment[j].id];cNode=i.getNode();if(!cNode){continue}if(i.mode=="thread"){if(!i.parentID){baseComments.push(i.id)}}else{if(i.mode=="approve"&&i.status=="hidden"){if(hidingListNode){hidingListNode.appendChild(cNode)}}else{if(i.mode=="approve"&&(i.status=="pending"||i.status=="deferred"||i.status=="revised")){if(pendingListNode){pendingListNode.appendChild(cNode)}}else{if(i.mode=="revise"&&i.status=="revise"&&reviseListNode){reviseListNode.appendChild(cNode)}}}}}if(firstThreadRun){setTimeout("buildFromBase();",10)}switch(g.return_view){case"thread":firstThreadRun=false;if(g.comment.length<1){noThread()}break;case"approve":firstApproveRun=false;break;case"revise":firstReviseRun=false;break}}var f=[];if(g.action){f=g.action}for(var j in f){switch(f[j].type){case"insert":comments[f[j].comment].insert();grow(f[j].comment);break;case"flag":comments[f[j].comment].flag(f[j].flag);break;case"unflag":comments[f[j].comment].unflag();break;case"hide":comments[f[j].comment].hide(true);break;case"approve":comments[f[j].comment].approve();break;case"open":case"close":case"reload":window.location.reload(true);break;case"makeprivate":Dom.get("cm_option_private").checked=true;break;case"makepublic":Dom.get("cm_option_private").checked=false;Dom.get("cm_option_cn").checked=true;break;case"enableanon":Dom.get("cm_option_anonymous").checked=true;break;case"disableanon":Dom.get("cm_option_anonymous").checked=false;break;case"enablelogged":Dom.get("cm_option_schoolwide").checked=true;break;case"disablelogged":Dom.get("cm_option_schoolwide").checked=false;break;case"threadrestriction":if(f[j].value==0){Dom.get("cm_option_mod").checked=false}else{Dom.get("cm_option_mod").checked=true}break;case"codename":if(f[j].value==0){Dom.get("cm_option_cn").checked=false;Dom.get("cm_option_private").checked=true}else{Dom.get("cm_option_cn").checked=true}break;case"openwindow":if(c.argument[0]){var h=c.argument[0].parentNode;var d=document.createElement("a");d.setAttribute("target","_blank");d.setAttribute("href",f[j].url);d.appendChild(document.createTextNode("open thread"));h.replaceChild(d,c.argument[0]);openWindow(f[j].url,true)}else{openWindow(f[j].url,false)}break;case"disablett":showTT=false;break;case"refresh":break}}updateTT(overlayContext);var b=false;if(pendingListNode&&(hiddenCount||pendingCount)){if(config.approveMode=="random"){b=YAHOO.util.Dom.get("cm_random_approve_help");YAHOO.util.Dom.setStyle(b,"display","block");YAHOO.util.Dom.setStyle(b,"visibility","inherit");b=YAHOO.util.Dom.get("cm_random_approve_help_small");YAHOO.util.Dom.setStyle(b,"display","inline");YAHOO.util.Dom.setStyle(b,"visibility","inherit")}else{if(config.approveMode=="org"){b=YAHOO.util.Dom.get("cm_org_approve_help");YAHOO.util.Dom.setStyle(b,"display","block");YAHOO.util.Dom.setStyle(b,"visibility","inherit");b=YAHOO.util.Dom.get("cm_org_approve_help_small");YAHOO.util.Dom.setStyle(b,"display","inline");YAHOO.util.Dom.setStyle(b,"visibility","inherit")}else{if(config.approveMode=="admin"){b=YAHOO.util.Dom.get("cm_approve_expander");YAHOO.util.Dom.setStyle(b,"display","none");YAHOO.util.Dom.setStyle(b,"visibility","hidden");showFullApprove()}else{b=YAHOO.util.Dom.get("cm_student_approve_help");YAHOO.util.Dom.setStyle(b,"display","block");YAHOO.util.Dom.setStyle(b,"visibility","inherit");b=YAHOO.util.Dom.get("cm_student_approve_help_small");YAHOO.util.Dom.setStyle(b,"display","inline");YAHOO.util.Dom.setStyle(b,"visibility","inherit")}}}showApprove();if(pendingCount){b=YAHOO.util.Dom.get("cm-h-pending");YAHOO.util.Dom.setStyle(b,"display","block");YAHOO.util.Dom.setStyle(b,"visibility","inherit");if(pendingAnonCount){b=YAHOO.util.Dom.get("cm-h-pending-anon");YAHOO.util.Dom.setStyle(b,"display","block");YAHOO.util.Dom.setStyle(b,"visibility","inherit")}}if(hiddenCount){b=YAHOO.util.Dom.get("cm-h-hiding");YAHOO.util.Dom.setStyle(b,"display","block");YAHOO.util.Dom.setStyle(b,"visibility","inherit")}}if(view=="thread"&&inlineApproveCount<1){b=YAHOO.util.Dom.get("cm_approve_help");YAHOO.util.Dom.setStyle(b,"display","none");YAHOO.util.Dom.setStyle(b,"visibility","hidden")}if(reviseListNode&&reviseCount<1){hideRevise()}if(!firstThreadRun&&!firstApproveRun&&!firstReviseRun){loading(false)}}function buildFromBase(){for(var b in baseComments){var d=comments[baseComments[b]];var c=d.getNode();threadListNode.appendChild(c)}}function destroyTT(){if(tt){tt.hide();tt.destroy();delete tt;tt=false}}function updateTT(d){if(!showTT){return 0}var c=[];var b;for(b in contextElements){c.push(contextElements[b])}for(b in d){c.push(d[b])}if(!tt){createTT(c)}else{tt.cfg.setProperty("context",c)}}function createTT(a){if(!showTT){return 0}tt=new YAHOO.widget.Tooltip("tt",{context:a,showDelay:500,zindex:7,autodismissdelay:40000})}var checkback={success:parseCheck,failure:ajaxFail};var callback={success:parseJSON,failure:ajaxFail};function checkForApproveHide(){if(!pendingListNode){return true}if(hiddenCount<1&&pendingCount<1){hideApprove();pendingListNode=false;return true}if(pendingCount<1){mNode=YAHOO.util.Dom.get("cm-h-pending");YAHOO.util.Dom.setStyle(mNode,"display","none");YAHOO.util.Dom.setStyle(mNode,"visibility","hidden")}else{if(pendingAnonCount<1){mNode=YAHOO.util.Dom.get("cm-h-pending-anon");YAHOO.util.Dom.setStyle(mNode,"display","none");YAHOO.util.Dom.setStyle(mNode,"visibility","hidden")}}if(hiddenCount<1){mNode=YAHOO.util.Dom.get("cm-h-hiding");YAHOO.util.Dom.setStyle(mNode,"display","none");YAHOO.util.Dom.setStyle(mNode,"visibility","hidden")}return false}function parseComments(c){for(var b in c){if(comments[c[b].id]===undefined){comments[c[b].id]=new Comment(c[b])}else{comments[c[b].id].loadData(c[b])}if(comments[c[b].id].mode=="thread"&&(comments[c[b].id].status=="hidden"||comments[c[b].id].status=="pending"||comments[c[b].id].status=="deferred"||comments[c[b].id].status=="revised")){inlineApproveCount++;if(inlineApproveCount==1){mNode=YAHOO.util.Dom.get("cm_approve_help");YAHOO.util.Dom.setStyle(mNode,"display","block");YAHOO.util.Dom.setStyle(mNode,"visibility","visible")}}else{if(comments[c[b].id].mode=="thread"&&comments[c[b].id].status=="revise"&&comments[c[b].id].authorID==config.userID){inlineReviseCount++}else{if(comments[c[b].id].mode=="approve"&&(comments[c[b].id].status=="pending"||comments[c[b].id].status=="deferred"||comments[c[b].id].status=="revised")){pendingCount++;if(!comments[c[b].id].authorID){pendingAnonCount++}}else{if(comments[c[b].id].mode=="approve"&&comments[c[b].id].status=="hidden"){hiddenCount++}else{if(comments[c[b].id].mode=="revise"&&comments[c[b].id].status=="revise"&&comments[c[b].id].authorID==config.userID){reviseCount++}}}}}}}function loading(a){loadNode=YAHOO.util.Dom.get("cm_loading");mainNode=YAHOO.util.Dom.get("cm_main");if(a){YAHOO.util.Dom.addClass(mainNode,"cm_hide");YAHOO.util.Dom.removeClass(loadNode,"cm_hide")}else{YAHOO.util.Dom.addClass(loadNode,"cm_hide");YAHOO.util.Dom.removeClass(mainNode,"cm_hide")}}function showApprove(){mNode=YAHOO.util.Dom.get("cm_approve");YAHOO.util.Dom.setStyle(mNode,"display","block");YAHOO.util.Dom.setStyle(mNode,"visibility","visible")}var approveIsOpen=false;function showFullApprove(){if(approveIsOpen){mNode=YAHOO.util.Dom.get("cm_approve_full");YAHOO.util.Dom.setStyle(mNode,"display","none");YAHOO.util.Dom.setStyle(mNode,"visibility","hidden");mNode=YAHOO.util.Dom.get("cm_subtract_gif");YAHOO.util.Dom.setStyle(mNode,"display","none");YAHOO.util.Dom.setStyle(mNode,"visibility","hidden");mNode=YAHOO.util.Dom.get("cm_expand_gif");YAHOO.util.Dom.setStyle(mNode,"display","inline");YAHOO.util.Dom.setStyle(mNode,"visibility","visible");approveIsOpen=false}else{mNode=YAHOO.util.Dom.get("cm_approve_full");YAHOO.util.Dom.setStyle(mNode,"display","block");YAHOO.util.Dom.setStyle(mNode,"visibility","visible");mNode=YAHOO.util.Dom.get("cm_expand_gif");YAHOO.util.Dom.setStyle(mNode,"display","none");YAHOO.util.Dom.setStyle(mNode,"visibility","hidden");mNode=YAHOO.util.Dom.get("cm_subtract_gif");YAHOO.util.Dom.setStyle(mNode,"display","inline");YAHOO.util.Dom.setStyle(mNode,"visibility","visible");approveIsOpen=true}}function hideApprove(){mNode=YAHOO.util.Dom.get("cm_approve");YAHOO.util.Dom.setStyle(mNode,"display","none");YAHOO.util.Dom.setStyle(mNode,"visibility","hidden")}function hideRevise(){mNode=YAHOO.util.Dom.get("cm_revise");YAHOO.util.Dom.setStyle(mNode,"display","none");YAHOO.util.Dom.setStyle(mNode,"visibility","hidden")}function showThread(){noThreadNode=YAHOO.util.Dom.get("cm_no_thread_instruct");YAHOO.util.Dom.setStyle(noThreadNode,"display","none");YAHOO.util.Dom.setStyle(noThreadNode,"visibility","hidden");threadInstructNode=YAHOO.util.Dom.get("cm_thread_instruct");YAHOO.util.Dom.setStyle(threadInstructNode,"display","block");YAHOO.util.Dom.setStyle(threadInstructNode,"visibility","inherit")}function noThread(){noThreadNode=YAHOO.util.Dom.get("cm_no_thread_instruct");YAHOO.util.Dom.setStyle(noThreadNode,"display","block");YAHOO.util.Dom.setStyle(noThreadNode,"visibility","inherit");threadInstructNode=YAHOO.util.Dom.get("cm_thread_instruct");YAHOO.util.Dom.setStyle(threadInstructNode,"display","none");YAHOO.util.Dom.setStyle(threadInstructNode,"visibility","hidden")}function openReply(b){var c=YAHOO.util.Dom.get("reply");var d=comments[b].divNode;d.appendChild(c);var a=YAHOO.util.Dom.get("reply_parent");a.value=b;c.content.value="";c.content.focus()}function closeReply(){if(view!="thread"){return false}var b=YAHOO.util.Dom.get("reply");var c=YAHOO.util.Dom.get("cm_holder");c.appendChild(b);var a=YAHOO.util.Dom.get("reply_parent");a.value=0}function openRevise(a){comments[a].fillRevise();var b=YAHOO.util.Dom.get("revise");var c=comments[a].divNode;c.appendChild(b);b.comment.value=a;b.content.focus()}function closeRevise(){var b=YAHOO.util.Dom.get("revise");var c=YAHOO.util.Dom.get("cm_holder");c.appendChild(b);var a=YAHOO.util.Dom.get("revise_comment");a.value=0}var currentTab=false;function addFlag(d,h){if(tt){tt.hide()}if(whyDialog){whyClose()}closeReply();var f=h[1];var j=h[0];var c=false;if(flags[f].hides){var g=document.createElement("div");var i=document.createElement("p");var c=flags[f].spawnIcon("why",false,false,true);i.appendChild(c);var a=document.createElement("b");a.appendChild(document.createTextNode(" "+flags[f].name));i.appendChild(a);i.appendChild(document.createElement("br"));i.appendChild(document.createTextNode(flags[f].description));g.appendChild(i);i=document.createElement("div");switch(f){case 16:i.appendChild(document.createTextNode("How should the author revise the comment?"));break;default:i.appendChild(document.createTextNode("Why is this comment "+flags[f].name.toLowerCase()+"?"));break}g.appendChild(i);fNode=document.createElement("form");fNode.id="cmFlagDialogForm";tNode=document.createElement("textarea");tNode.name="remark";tNode.setAttribute("cols","50");tNode.setAttribute("rows","8");fNode.appendChild(tNode);hNode=document.createElement("input");hNode.name="comment";hNode.type="hidden";hNode.value=j;fNode.appendChild(hNode);hNode=document.createElement("input");hNode.name="flag";hNode.type="hidden";hNode.value=f;fNode.appendChild(hNode);g.appendChild(fNode);flagDialog.setBody(g);flagDialog.show()}else{var b="/modules/comment/data.php?return=json&action=flag&view="+view+"&flag="+f;if(undefined!==window.thread){b+="&thread="+thread}b+="&comment="+j+"&lastload="+config.lastload+"&sessionid="+sessionid;YAHOO.util.Connect.asyncRequest("GET",b,callback)}if(whyDialog){whyClose()}}function removeFlag(b,a){var c="/modules/comment/data.php?return=json&action=unflag&view="+view;if(undefined!==window.thread){c+="&thread="+thread}c+="&comment="+a[0]+"&lastload="+config.lastload+"&sessionid="+sessionid;YAHOO.util.Connect.asyncRequest("GET",c,callback);whyDialog.hide()}function revise(b,a){var c=16;divNode=document.createElement("div");pNode=document.createElement("div");pNode.appendChild(document.createTextNode("Why "));iNode=flags[c].spawnIcon("cfd");iNode.title="";pNode.appendChild(iNode);pNode.appendChild(document.createTextNode("?"));divNode.appendChild(pNode);fNode=document.createElement("form");fNode.id="cmFlagDialogForm";tNode=document.createElement("textarea");tNode.name="remark";tNode.setAttribute("cols","48");tNode.setAttribute("rows","8");fNode.appendChild(tNode);hNode=document.createElement("input");hNode.name="comment";hNode.type="hidden";hNode.value=a;fNode.appendChild(hNode);hNode=document.createElement("input");hNode.name="flag";hNode.type="hidden";hNode.value=c;fNode.appendChild(hNode);divNode.appendChild(fNode);flagDialog.setBody(divNode);flagDialog.show()}var addFlagRemark=function(){formNode=YAHOO.util.Dom.get("cmFlagDialogForm");var c="/modules/comment/data.php?return=json&action=flag&lastload="+config.lastload+"&sessionid="+sessionid;if(undefined!==window.thread){c+="&thread="+thread}var a="view="+view;for(var b=0;b<formNode.length;b++){a+="&"+formNode.elements[b].name+"="+myEscape(formNode.elements[b].value)}YAHOO.util.Connect.asyncRequest("POST",c,callback,a);flagDialog.hide()};var closeFlagRemark=function(){flagDialog.hide()};function testReply(){var c=document.getElementById("reply");var d="/modules/comment/check.php?return=json&check=comment&count="+checkCount+"&lastload="+config.lastload;if(undefined!==window.thread){d+="&thread="+thread}var a="view="+view;for(var b=0;b<c.length;b++){a+="&"+c.elements[b].name+"="+myEscape(c.elements[b].value)}YAHOO.util.Connect.asyncRequest("POST",d,checkback,a);checkQueue[checkCount]="sendReply";checkCount++}function myEscape(a){return escape(a.replace("+","%2B"))}function sendReply(){var d=document.getElementById("reply");var c="/modules/comment/data.php?return=json&action=reply&lastload="+config.lastload;if(undefined!==window.thread){c+="&thread="+thread}var a="view="+view+"&cm_mask="+addMaskValue;for(var b=0;b<d.length;b++){a+="&"+d.elements[b].name+"="+myEscape(d.elements[b].value.replace("+","%2B"))}YAHOO.util.Connect.asyncRequest("POST",c,callback,a);closeReply()}function sendRevise(){var d=document.getElementById("revise");var c="/modules/comment/data.php?return=json&action=revise&lastload="+config.lastload;if(undefined!==window.thread){c+="&thread="+thread}var a="view="+view;for(var b=0;b<d.length;b++){a+="&"+d.elements[b].name+"="+myEscape(d.elements[b].value)}YAHOO.util.Connect.asyncRequest("POST",c,callback,a);closeRevise()}function sendFlatRevise(b){comment=comments[b];var c="/modules/comment/data.php?return=json&action=revise&lastload="+config.lastload;if(undefined!==window.thread){c+="&thread="+thread}var a="view="+view+"&comment="+b+"&content="+myEscape(comment.contentNode.value)+"&sessionid="+sessionid;YAHOO.util.Connect.asyncRequest("POST",c,callback,a)}function deleteRevise(){var d=document.getElementById("revise");var c="/modules/comment/data.php?return=json&action=remove&lastload="+config.lastload;if(undefined!==window.thread){c+="&thread="+thread}var a="view="+view;for(var b=0;b<d.length;b++){a+="&"+d.elements[b].name+"="+myEscape(d.elements[b].value);if(d.elements[b].name=="comment"){commentID=d.elements[b].value}}closeRevise();YAHOO.util.Connect.asyncRequest("POST",c,callback,a)}function deleteComment(b){var c="/modules/comment/data.php?return=json&action=remove&lastload="+config.lastload;if(undefined!==window.thread){c+="&thread="+thread}var a="view="+view+"&comment="+b+"&sessionid="+sessionid;YAHOO.util.Connect.asyncRequest("POST",c,callback,a)}function testAdd(){var c=document.getElementById("addcomment");var d="/modules/comment/check.php?return=json&thread="+thread+"&check=comment&count="+checkCount+"&lastload="+config.lastload;var a="view="+view;for(var b=0;b<c.length;b++){a+="&"+c.elements[b].name+"="+myEscape(c.elements[b].value)}YAHOO.util.Connect.asyncRequest("POST",d,checkback,a);checkQueue[checkCount]="sendAdd";checkCount++}function sendAdd(){var d=document.getElementById("addcomment");var c="/modules/comment/data.php?return=json&action=add&thread="+thread+"&view="+view+"&lastload="+config.lastload;var a="cm_mask="+addMaskValue;for(var b=0;b<d.length;b++){a+="&"+d.elements[b].name+"="+myEscape(d.elements[b].value)}YAHOO.util.Connect.asyncRequest("POST",c,callback,a);d.content.value="";d.content.focus();cm_toggle_tab("cm_add_comment")}var addMaskValue=true;function addMask(a){addMaskValue=a}function toggleThread(a){if(a.checked){var b="/modules/comment/data.php?return=json&action=open&view=thread&thread="+thread+"&lastload="+config.lastload+"&sessionid="+sessionid;YAHOO.util.Connect.asyncRequest("GET",b,callback)}else{var b="/modules/comment/data.php?return=json&action=close&view=thread&thread="+thread+"&lastload="+config.lastload+"&sessionid="+sessionid;YAHOO.util.Connect.asyncRequest("GET",b,callback)}}function toggleAnon(a){if(a.checked){var b="/modules/comment/data.php?return=json&action=enableanon&view=thread&thread="+thread+"&lastload="+config.lastload+"&sessionid="+sessionid;YAHOO.util.Connect.asyncRequest("GET",b,callback)}else{var b="/modules/comment/data.php?return=json&action=disableanon&view=thread&thread="+thread+"&lastload="+config.lastload+"&sessionid="+sessionid;YAHOO.util.Connect.asyncRequest("GET",b,callback)}}function toggleSW(a){if(a.checked){var b="/modules/comment/data.php?return=json&action=enablelogged&view=thread&thread="+thread+"&lastload="+config.lastload+"&sessionid="+sessionid;YAHOO.util.Connect.asyncRequest("GET",b,callback)}else{var b="/modules/comment/data.php?return=json&action=disablelogged&view=thread&thread="+thread+"&lastload="+config.lastload+"&sessionid="+sessionid;YAHOO.util.Connect.asyncRequest("GET",b,callback)}}function togglePrivate(a){if(a.checked){var b="/modules/comment/data.php?return=json&action=makeprivate&view=thread&thread="+thread+"&lastload="+config.lastload+"&sessionid="+sessionid;YAHOO.util.Connect.asyncRequest("GET",b,callback)}else{var b="/modules/comment/data.php?return=json&action=makepublic&view=thread&thread="+thread+"&lastload="+config.lastload+"&sessionid="+sessionid;YAHOO.util.Connect.asyncRequest("GET",b,callback)}}function toggleModPri(a){if(a.checked){var b="/modules/comment/data.php?return=json&action=threadrestriction&restriction=8&view=thread&thread="+thread+"&lastload="+config.lastload+"&sessionid="+sessionid;YAHOO.util.Connect.asyncRequest("GET",b,callback)}else{var b="/modules/comment/data.php?return=json&action=threadrestriction&restriction=0&view=thread&thread="+thread+"&lastload="+config.lastload+"&sessionid="+sessionid;YAHOO.util.Connect.asyncRequest("GET",b,callback)}}function toggleCN(a){if(a.checked){var b="/modules/comment/data.php?return=json&action=enablecodename&view=thread&thread="+thread+"&lastload="+config.lastload+"&sessionid="+sessionid;YAHOO.util.Connect.asyncRequest("GET",b,callback)}else{var b="/modules/comment/data.php?return=json&action=disablecodename&view=thread&thread="+thread+"&lastload="+config.lastload+"&sessionid="+sessionid;YAHOO.util.Connect.asyncRequest("GET",b,callback)}}function toggleAge(a){if(a.checked){YAHOO.util.Dom.addClass("comments","show_age")}else{YAHOO.util.Dom.removeClass("comments","show_age")}}function populateReport(){var a={success:processReport,failure:ajaxFail};var b="/modules/comment/data.php?return=html&newload=true&view=threadreport&thread="+thread+"&sessionid="+sessionid;YAHOO.util.Connect.asyncRequest("GET",b,a)}function approve(a,c){var b="/modules/comment/data.php?return=json&action=approve&comment="+c.id+"&view="+view+"&lastload="+config.lastload+"&sessionid="+sessionid;if(undefined!==window.thread){b+="&thread="+thread}YAHOO.util.Connect.asyncRequest("GET",b,callback)}function reject(a,c){var b="/modules/comment/data.php?return=json&action=reject&comment="+c.id+"&view="+view+"&lastload="+config.lastload+"&sessionid="+sessionid;if(undefined!==window.thread){b+="&thread="+thread}YAHOO.util.Connect.asyncRequest("GET",b,callback)}function defer(a,c){var b="/modules/comment/data.php?return=json&action=defer&comment="+c.id+"&view="+view+"&lastload="+config.lastload+"&sessionid="+sessionid;if(undefined!==window.thread){b+="&thread="+thread}YAHOO.util.Connect.asyncRequest("GET",b,callback)}function censor(b,a){var c="/modules/comment/data.php?return=json&action=censor&comment="+a+"&view="+view+"&lastload="+config.lastload+"&sessionid="+sessionid;if(undefined!==window.thread){c+="&thread="+thread}YAHOO.util.Connect.asyncRequest("GET",c,callback)}function dismiss(b,a){var c="/modules/comment/data.php?return=json&action=dismiss&comment="+a+"&view="+view+"&lastload="+config.lastload+"&sessionid="+sessionid;if(undefined!==window.thread){c+="&thread="+thread}YAHOO.util.Connect.asyncRequest("GET",c,callback)}function geturl(a,c){var b="/modules/comment/data.php?return=json&view=commenturl&comment="+c.id+"&lastload="+config.lastload+"&sessionid="+sessionid;newcb=callback;newcb.argument=[YAHOO.util.Event.getTarget(a)];YAHOO.util.Connect.asyncRequest("GET",b,newcb)}function refreshThread(b){if(b){bNode=YAHOO.util.Dom.get(b);bNode.blur()}var a="/modules/comment/data.php?return=json&action=refresh&view=thread&thread="+thread+"&lastload="+config.lastload+"&sessionid="+sessionid;YAHOO.util.Connect.asyncRequest("GET",a,callback)}function removeChild(c,b,d){if(d.parentID){comments[d.parentID].removeChild(d.id)}}function removeBaseComment(c,b,d){d.node.parentNode.removeChild(d.node)}function shrink(){this.shrink();closeReply()}function grow(a){comments[a].grow()}function sortComments(b){sort_method=b;baseComments=sortCommentList(baseComments);reorderBaseComments();for(var c in comments){comments[c].sortReplies(false);comments[c].reorderReplies(false)}}function sortCommentList(list){if(!sort_method){return 0}if(list.length<2){return list}newList=[];switch(sort_method){case"date_asc":sortItem="madestamp";sortOrder="<";break;case"date_desc":sortItem="madestamp";sortOrder=">";break;case"merit":sortItem="power";sortOrder=">";break}for(var a in list){var targ=-1;for(var b in list){var inArray=false;for(var c in newList){if(newList[c]==list[b]){inArray=true}}if(inArray){continue}if(targ<0){targ=b;continue}compareString="if(comments[list[b]]."+sortItem+" "+sortOrder+" comments[list[targ]]."+sortItem+"){ targ=b; }";eval(compareString)}newList[a]=list[targ]}return newList}function reorderBaseComments(){if(baseComments.length<2){return true}if(!threadListNode.hasChildNodes()){return true}for(var b in baseComments){threadListNode.removeChild(comments[baseComments[b]].getNode())}for(var b in baseComments){threadListNode.appendChild(comments[baseComments[b]].getNode())}cmNode=comments[baseComments[baseComments.length-1]].getNode()}function whyFlag(l,d){var h;if(YAHOO.env.ua.ie>=5.5&&document.body.filters){h="<span class='ie-png' style=\"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/modules/comment/icons/f"+d[1]+".png', sizingMethod='scale')\"></span>"}else{h="<img src='/modules/comment/icons/f"+d[1]+".png' alt=''/>"}destroyTT();comment=d[0];if(!whyDialog){whyDialog=new YAHOO.widget.Dialog("cmWhyDialog",{width:"220px",fixedcenter:true,visible:false,draggable:false,close:false,modal:true,zindex:5,constraintoviewport:true});YAHOO.util.Event.addListener(whyDialog,"cancel",whyClose)}else{var i=whyDialog.getButtons();for(var k in i){if(i[k].get("label").substr(0,1)=="K"){i[k].set("label","Keep "+h);i[k].unsubscribeAll();i[k].subscribe("click",addFlag,d)}else{i[k].set("label","Cancel "+h);i[k].unsubscribeAll();i[k].subscribe("click",removeFlag,d)}}}var g=document.createElement("span");g.appendChild(document.createTextNode("Why "));if(YAHOO.env.ua.ie>=5.5&&document.body.filters){var e=document.createElement("span");YAHOO.util.Dom.setStyle(e,"filter","progid:DXImageTransform.Microsoft.AlphaImageLoader(src='/modules/comment/icons/f"+d[1]+".png', sizingMethod='scale')");YAHOO.util.Dom.addClass(e,"ie-png");g.appendChild(e)}else{var e=document.createElement("img");e.setAttribute("src","/modules/comment/icons/f"+d[1]+".png");g.appendChild(e)}g.appendChild(document.createTextNode("?"));whyDialog.setHeader(g);var j=document.createElement("ul");g=document.createElement("span");var m="Why do you think this comment is ";if(d[1]==17){m+="a "}m+=flags[d[1]].name.toLowerCase()+"?";g.appendChild(document.createTextNode(m));j.appendChild(g);var c=document.createElement("ul");var f;var e;for(var k in flags){if(flags[k].parent==d[1]){f=document.createElement("li");e=flags[k].spawnIcon("temp-"+d[0],false,true);YAHOO.util.Event.addListener(e,"click",addFlag,[d[0],flags[k].id]);e.appendChild(document.createTextNode(" "+flags[k].name));f.appendChild(e);c.appendChild(f);overlayContext.push(e.id)}}j.appendChild(c);var b=document.createElement("button");b.innerHTML="Keep "+h;YAHOO.util.Event.addListener(b,"click",addFlag,d);j.appendChild(b);b=document.createElement("button");b.innerHTML="Cancel "+h;YAHOO.util.Event.addListener(b,"click",removeFlag,d);j.appendChild(b);whyDialog.setBody(j);whyDialog.render(document.body);whyDialog.show();createTT(overlayContext)}function whyClose(){overlayContext=[];if(whyDialog.cfg.getProperty("visible")){destroyTT();whyDialog.cancel();createTT(overlayContext)}}function modal(d,f){if(!modalPanel){modalPanel=new YAHOO.widget.Dialog("modalpanel",{width:"350px",fixedcenter:true,visible:false,draggable:false,close:false,modal:true,constraintoviewport:true,buttons:[{text:"Submit",handler:modalYes,isDefault:true},{text:"Cancel",handler:modalNo}]});var b=document.createElement("span");var e=document.createElement("img");e.setAttribute("src","/modules/comment/icons/f12.png");e.setAttribute("alt","Warning");b.appendChild(e);b.appendChild(document.createTextNode(" Warning!"));modalPanel.setHeader(b);modalPanel.setBody(" ");modalPanel.render(document.body);currentCheck=f}var g=document.createElement("div");for(var c in d){var h=document.createElement("p");wikiParse(d[c],h);g.appendChild(h)}var h=document.createElement("p");h.appendChild(document.createTextNode("Would you like to continue to submit this comment?"));g.appendChild(h);modalPanel.setBody(g);modalPanel.show()}function modalYes(){eval(checkQueue[currentCheck]+"()");modalPanel.hide()}function modalNo(){modalPanel.hide()}function notify(c){notePanel.render(document.body);nNode=document.getElementById("notepanel_c");var d="<ul>";for(var a in c){d+="<li>"+c[a]+"</li>"}d+="</ul>";var e=3+(c.length*4);notePanel.setBody(d);notePanel.show();if(YAHOO.env.ua.ie>0){setTimeout("notePanel.hide()",e*1000)}else{var b={opacity:{from:1,to:0}};pendAnim=new YAHOO.util.Anim("notepanel_c",b,1);pendAnim.onComplete.subscribe(function(){notePanel.hide();YAHOO.util.Dom.setStyle("notepanel_c","opacity",1)});setTimeout("pendAnim.animate()",e*1000)}}var wikiSyntax=[];var wikiName=[];wikiSyntax[0]="'''";wikiName[0]="bold";wikiSyntax[1]="''";wikiName[1]="italic";wikiSyntax[2]="[";wikiName[2]="anchor";wikiSyntax[3]="%br%";wikiName[3]="break";wikiSyntax[4]="\n";wikiName[4]="newline";wikiSyntax[5]="|!";wikiName[5]="censor";wikiSyntax[6]="|cn";wikiName[6]="codename";function wikiParse(h,j,r){var p="none";var o="";var t=99999;for(var f in wikiSyntax){var g=wikiSyntax[f];var a=h.indexOf(g);if(a>-1&&a<t){t=a;p=wikiName[f];o=g}}if(r){var a=h.search("/"+r+"/i");if(a>-1&&a<t){t=a;p="search";o=r}}if(p=="none"){j.appendChild(document.createTextNode(h));return}var i=h.substring(0,t);j.appendChild(document.createTextNode(i));var b;switch(p){case"bold":var d=j.appendChild(document.createElement("b"));tStart=t+o.length;tEnd=h.indexOf(o,tStart+1);if(tEnd<1){j.appendChild(document.createTextNode(o));b=t+o.length;break}tLen=tEnd-tStart;var c=h.substr(tStart,tLen);d.appendChild(document.createTextNode(c));b=tEnd+o.length;break;case"italic":var k=j.appendChild(document.createElement("i"));tStart=t+o.length;tEnd=h.indexOf(o,tStart+1);if(tEnd<1){j.appendChild(document.createTextNode(o));b=t+o.length;break}tLen=tEnd-tStart;iText=h.substr(tStart,tLen);k.appendChild(document.createTextNode(iText));b=tEnd+o.length;break;case"anchor":hStart=t+1;hEnd=h.indexOf(" ",hStart);hLen=hEnd-hStart;tStart=hEnd+1;tEnd=h.indexOf("]");if(tEnd<1){j.appendChild(document.createTextNode(o));b=t+o.length;break}tLen=tEnd-tStart;linkText=h.substr(tStart,tLen);linkHref=h.substr(hStart,hLen);if(linkHref.indexOf("http:")!=0&&linkHref.indexOf("/")!=0){j.appendChild(document.createTextNode(o));b=t+o.length;break}var m=j.appendChild(document.createElement("a"));m.appendChild(document.createTextNode(linkText));m.setAttribute("href",linkHref);if(linkHref.indexOf("http:")==0){m.setAttribute("target","_blank")}b=tEnd+1;break;case"censor":var s=j.appendChild(document.createElement("span"));YAHOO.util.Dom.addClass(s,"cm_censorbar");tStart=t+o.length;tEnd=h.indexOf("!|",tStart);if(tEnd<1){j.appendChild(document.createTextNode(o));b=t+o.length;break}tLen=tEnd-tStart;cText="";for(var q=0;q<tLen;q++){cText+="*"}s.appendChild(document.createTextNode(cText));if(config.isAdmin){realText=h.substr(tStart,tLen);s.title=realText}b=tEnd+2;break;case"color":case"codename":var m=j.appendChild(document.createElement("span"));hStart=t+o.length;hEnd=h.indexOf(" ",hStart);hLen=hEnd-hStart;tStart=hEnd+1;tEnd=h.indexOf("c|");if(tEnd<1){j.appendChild(document.createTextNode(o));b=t+o.length;break}tLen=tEnd-tStart;linkText=h.substr(tStart,tLen);if(p=="codename"){YAHOO.util.Dom.addClass(m,"cm_codename")}m.appendChild(document.createTextNode(linkText));var l=h.substr(hStart,hLen);if(isLightColor(l)){YAHOO.util.Dom.setStyle(m,"background-color",l);YAHOO.util.Dom.setStyle(m,"color","#111111")}else{YAHOO.util.Dom.setStyle(m,"color",l);YAHOO.util.Dom.setStyle(m,"background-color","transparent")}b=tEnd+2;break;case"break":case"newline":var n=j.appendChild(document.createElement("br"));b=t+o.length;break;default:case"search":var s=j.appendChild(document.createElement("span"));YAHOO.util.Dom.addClass(s,"cm_searchword");sText=h.substr(t,o.length);s.appendChild(document.createTextNode(sText));b=t+o.length;break}wikiParse(h.substr(b),j,r)}var navTabs;function cm_toggle_tab(a,c){var b=YAHOO.util.Dom.get(c);if(YAHOO.util.Dom.getStyle(b,"visibility")=="hidden"){cm_close_tabs();YAHOO.util.Dom.setStyle(b,"display","block");YAHOO.util.Dom.setStyle(b,"visibility","visible");if(c=="cm_add_comment"){formNode=YAHOO.util.Dom.get("addcomment");if(formNode.content.value==" "){formNode.content.value=""}formNode.content.focus()}}else{cm_close_tabs()}}function cm_close_tabs(){var b;for(b in navTabs){aNode=navTabs[b].getElementsByTagName("a")[0];iNode=aNode.getElementsByTagName("img")[0]}var c=YAHOO.util.Dom.getElementsByClassName("liquidBoxShort","div","cm_head_content");for(b in c){YAHOO.util.Dom.setStyle(c[b],"display","none");YAHOO.util.Dom.setStyle(c[b],"visibility","hidden")}}function loginToAdd(){aNode=YAHOO.util.Dom.get("cm_add_comment_tab");YAHOO.util.Event.removeListener(aNode,"click",cm_toggle_tab);YAHOO.util.Event.addListener(aNode,"click",cm_toggle_tab,"cm_add_comment");cm_toggle_tab(null,"cm_add_comment")}function cm_tab_init(){navTabs=YAHOO.util.Dom.getElementsByClassName("cm_head_tab","li","cm_head_nav");var b;var c;var d;for(b in navTabs){c=navTabs[b].getElementsByTagName("a")[0];d=c.getAttribute("href");d=d.substring(d.indexOf("#")+1);c.removeAttribute("href");YAHOO.util.Event.addListener(c,"click",cm_toggle_tab,d);iNode=c.getElementsByTagName("img")[0];YAHOO.util.Event.addListener(c,"mouseover",imgOver,iNode);YAHOO.util.Event.addListener(c,"mouseout",imgOut,iNode)}var e=YAHOO.util.Dom.getElementsByClassName("cm_head_button","li","cm_head_nav");for(b in e){iNode=e[b].getElementsByTagName("img")[0];YAHOO.util.Event.addListener(iNode,"mouseover",imgOver,iNode);YAHOO.util.Event.addListener(iNode,"mouseout",imgOut,iNode)}}function cm_init(){skinBody();cm_tab_init();threadListNode=YAHOO.util.Dom.get("comments");pendingListNode=YAHOO.util.Dom.get("comments-pending");if(pendingListNode){hidingListNode=YAHOO.util.Dom.get("comments-hiding");invisListNode=YAHOO.util.Dom.get("comments-invisible");while(pendingListNode.hasChildNodes()){pendingListNode.removeChild(pendingListNode.firstChild)}while(invisListNode.hasChildNodes()){invisListNode.removeChild(invisListNode.firstChild)}}else{reviseListNode=YAHOO.util.Dom.get("comments-revision")}notePanel=new YAHOO.widget.Panel("notepanel",{width:"300px",visible:false,draggable:false,fixedcenter:true});notePanel.setHeader("Notification");notePanel.setBody("Notification");views=view.split("-");var a="/modules/comment/data.php?return=json&view="+view+"&newload=true";if(view=="thread"&&thread!==undefined){a+="&thread="+thread;firstThreadRun=true}if(view=="approve"&&numApproves){a+="&numApproves="+numApproves;firstApproveRun=true}if(view=="revise"){firstReviseRun=true}a+="&sessionid="+sessionid;YAHOO.util.Connect.asyncRequest("GET",a,callback);flagDialog=new YAHOO.widget.Dialog("cmFlagDialog",{width:"37em",fixedcenter:true,visible:false,constraintoviewport:true,buttons:[{text:"Submit",handler:addFlagRemark,isDefault:true},{text:"Cancel",handler:closeFlagRemark}]});flagDialog.setHeader("Please provide some feedback");flagDialog.setBody(" ");flagDialog.render(document.body);tooltipEnhance()}YAHOO.util.Event.onDOMReady(cm_init);