
Date.prototype.getDayString=function(){switch(this.getDay()){case 0:return'Sunday';case 1:return'Monday';case 2:return'Tuesday';case 3:return'Wednesday';case 4:return'Thursday';case 5:return'Friday';case 6:return'Saturday';}};Date.prototype.getMonthString=function(full){switch(this.getMonth()){case 0:return(full)?'January':'Jan';case 1:return(full)?'February':'Feb';case 2:return(full)?'March':'Mar';case 3:return(full)?'April':'Apr';case 4:return'May';case 5:return(full)?'June':'Jun';case 6:return(full)?'July':'Jul';case 7:return(full)?'August':'Aug';case 8:return(full)?'September':'Sep';case 9:return(full)?'October':'Oct';case 10:return(full)?'November':'Nov';case 11:return(full)?'December':'Dec';}};Date.prototype.spanishDay=function(){switch(this.getDay()){case 0:return'domingo';case 1:return'lunes';case 2:return'martes';case 3:return'mi&eacute;rcoles';case 4:return'jueves';case 5:return'viernes';case 6:return's&aacute;bado';}};Date.prototype.obtenerDia=Date.prototype.spanishDay;Date.prototype.spanishMonth=function(full){switch(this.getMonth()){case 0:return(full)?'enero':'ene';case 1:return(full)?'febrero':'feb';case 2:return(full)?'marzo':'mar';case 3:return(full)?'abril':'abr';case 4:return(full)?'mayo':'may';case 5:return(full)?'junio':'jun';case 6:return(full)?'julio':'jul';case 7:return(full)?'augusto':'aug';case 8:return(full)?'septiembre':'sep';case 9:return(full)?'octubre':'oct';case 10:return(full)?'noviembre':'nov';case 11:return(full)?'deciembre':'dec';}};Date.prototype.obtenerMes=Date.prototype.spanishMonth;Date.prototype.toFormattedString=function(f){var a,b;var d0=(this.getDate()<10)?'0'+this.getDate():this.getDate();var h0=(this.getHours()<10)?'0'+this.getHours():this.getHours();var m0=(this.getMinutes()<10)?'0'+this.getMinutes():this.getMinutes();var s0=(this.getSeconds()<10)?'0'+this.getSeconds():this.getSeconds();var mo0=this.getMonth()+1;mo0=(mo0<10)?'0'+mo0:mo0;f=f.replace(/%%/g,'%');f=f.replace(/%A/g,this.getDayString());f=f.replace(/%a/g,this.getDayString().substring(0,3));f=f.replace(/%B/g,this.getMonthString(true));f=f.replace(/%b/g,this.getMonthString());f=f.replace(/%c/g,this.getDayString().substring(0,3)+' '+
this.getMonthString()+' '+
d0+' '+h0+':'+m0+':'+s0+' '+
this.getFullYear());a=this.getFullYear()+'';a=a.substring(2);f=f.replace(/%D/g,mo0+'/'+d0+'/'+a);f=f.replace(/%d/g,d0);a=this.getDate();switch(a){case 1:case 21:case 31:a=a+'st';break;case 3:case 23:a=a+'rd';break;default:a=a+'th';}
f=f.replace(/%E/g,a);f=f.replace(/%e/g,this.getDate());f=f.replace(/%F/g,this.getFullYear()+'-'+mo0+'-'+d0);f=f.replace(/%H/g,h0);a=(this.getHours()>12)?this.getHours()-12:this.getHours();f=f.replace(/%I/g,(a<10)?'0'+a:a);f=f.replace(/%k/g,this.getHours());f=f.replace(/%l/g,(this.getHours()>12)?this.getHours()-12:this.getHours());f=f.replace(/%M/g,m0);f=f.replace(/%m/g,mo0);f=f.replace(/%O/g,this.spanishDay());f=f.replace(/%o/g,this.spanishDay().substring(0,3));f=f.replace(/%p/g,(this.getHours()>11)?'PM':'AM');f=f.replace(/%Q/g,this.spanishMonth(true));f=f.replace(/%q/g,this.spanishMonth().substring(0,3));f=f.replace(/%R/g,h0+':'+m0);a=(this.getHours()>12)?this.getHours()-12:this.getHours();a=(a<10)?'0'+a:a;b=(this.getHours()>11)?'PM':'AM';f=f.replace(/%r/g,a+':'+m0+':'+s0+' '+b);f=f.replace(/%S/g,s0);f=f.replace(/%s/g,Date.parse(this)/1000);f=f.replace(/%T/g,h0+':'+m0+':'+s0);f=f.replace(/%u/g,(this.getDay()===0)?7:this.getDay());f=f.replace(/%v/g,this.getDate()+'-'+this.getMonthString()+'-'+this.getFullYear());f=f.replace(/%w/g,this.getDay());f=f.replace(/%X/g,this.toLocaleTimeString());f=f.replace(/%Y/g,this.getFullYear());a=this.getFullYear()+'';f=f.replace(/%y/g,a.substring(2));return f;};
NYX.Pager=function(paramBag){NYX.util.obj.extend(this,NYX.TemplateTool);this.CSS_CLASS_PAGELINKS="paginationNavLinks";this.CSS_CLASS_CDTRANSPORT="paginationTransport";this.CSS_CLASS_SELECT="paginationDropDown";this.alwaysShowJumpNav=false;this.alwaysShowTransport=true;this.linkLimit=10;NYX.util.obj.extend(this,paramBag);this.pageVarName="pageNum";this.transportMaker=null;this.dropDownMaker=null;this.getPageCount=function(){var count=Math.ceil(this.totalItems/this.pageLength);return count;};this.currentPage=NYX.util.querystring.get(this.pageVarName);if(this.currentPage===null||this.currentPage<1){this.currentPage=1;}
this.writeGui=function(){this.linkLimit=Math.abs(this.linkLimit);this.pageCount=this.getPageCount();this.firstItem=(this.currentPage-1)*this.pageLength+1;this.lastItem=this.firstItem+(this.pageLength-1);if(this.lastItem>this.totalItems){this.lastItem=this.totalItems;}
if(NYX.util.string.contains(this.template,"pageLinks")){this.pageLinks=this.getPageLinks();}
if(NYX.util.string.contains(this.template,"pageDropDown")){this.pageDropDown=this.getDropDownCtrl();}
if(NYX.util.string.contains(this.template,"cdTransport")){this.cdTransport=this.getTransportCtrl();}
this.domTargetElem.innerHTML=this.processTemplate(this,this.template);};this.getPageLinks=function(){var wrapper=document.createElement("ins");var innerWrapper=document.createElement("span");innerWrapper.className=this.CSS_CLASS_PAGELINKS;wrapper.appendChild(innerWrapper);var actualLinkLimit=(this.pageCount<this.linkLimit)?this.pageCount:this.linkLimit;var startPage=this.currentPage-Math.floor(this.linkLimit/3)-1;if(startPage+actualLinkLimit>this.pageCount){startPage=this.pageCount-actualLinkLimit+1;}
if(startPage<1){startPage=1;}
for(var linkCount=0;linkCount<actualLinkLimit;linkCount++){var jumpNum=linkCount+startPage;var tag;if(jumpNum!=this.currentPage){tag=document.createElement("a");tag.href=NYX.util.querystring.set(this.pageVarName,jumpNum);tag.href=tag.href.replace(/mi_pluck_action=[^&]*&*/i,'');tag.href+='&mi_pluck_action=page_nav#Comments_Container';}else{tag=document.createElement("span");}
tag.innerHTML=jumpNum;innerWrapper.appendChild(tag);}
return wrapper.innerHTML;};this.getTransportCtrl=function(){if(!(this.pageCount>1||this.alwaysShowTransport)){return"";}
if(this.transportMaker===null){this.transportMaker=new NYX.TextCDButtons(this);}
return this.transportMaker.getHTML();};this.getDropDownCtrl=function(){if(!(this.pageCount>1||this.alwaysShowJumpNav)){return"";}
if(this.dropDownMaker===null){this.dropDownMaker=new NYX.PageSelect(this);}
return this.dropDownMaker.getHTML();};};NYX.TextCDButtons=function(parent){this.parent=parent;this.SYM_FIRST="&laquo;";this.SYM_PREV="&lt;";this.SYM_NEXT="&gt;";this.SYM_LAST="&raquo;";this.getHTML=function(){var wrapper=document.createElement("ins");var innerWrapper=document.createElement("span");innerWrapper.className=this.parent.CSS_CLASS_CDTRANSPORT;wrapper.appendChild(innerWrapper);var tag;if(this.parent.currentPage>1){tag=document.createElement("a");tag.href=NYX.util.querystring.set(this.parent.pageVarName,1);}else{tag=document.createElement("span");}
tag.innerHTML=this.SYM_FIRST;innerWrapper.appendChild(tag);if(this.parent.currentPage>1){tag=document.createElement("a");tag.href=NYX.util.querystring.set(this.parent.pageVarName,this.parent.currentPage-1);}else{tag=document.createElement("span");}
tag.innerHTML=this.SYM_PREV;innerWrapper.appendChild(tag);if(this.parent.currentPage<this.parent.pageCount){tag=document.createElement("a");tag.href=NYX.util.querystring.set(this.parent.pageVarName,this.parent.currentPage+1);}else{tag=document.createElement("span");}
tag.innerHTML=this.SYM_NEXT;innerWrapper.appendChild(tag);if(this.parent.currentPage<this.parent.pageCount){tag=document.createElement("a");tag.href=NYX.util.querystring.set(this.parent.pageVarName,this.parent.pageCount);}else{tag=document.createElement("span");}
tag.innerHTML=this.SYM_LAST;innerWrapper.appendChild(tag);return wrapper.innerHTML;};};NYX.PrevNextLinks=function(parent,paramBag){this.parent=parent;this.JOINER="&nbsp;";this.TEXT_FIRST="First";this.TEXT_PREV="Prev";this.TEXT_NEXT="Next";this.TEXT_LAST="Last";if(typeof paramBag=="object"){NYX.util.obj.extend(this,paramBag);}
NYX.util.obj.extend(this,new NYX.TextCDButtons(this.parent));if(this.killSymbols){this.SYM_FIRST=this.TEXT_FIRST;this.SYM_PREV=this.TEXT_PREV;this.SYM_NEXT=this.TEXT_NEXT;this.SYM_LAST=this.TEXT_LAST;}else{this.SYM_FIRST+=this.JOINER+this.TEXT_FIRST;this.SYM_PREV+=this.JOINER+this.TEXT_PREV;this.SYM_NEXT+=this.JOINER+this.TEXT_NEXT;this.SYM_LAST+=this.JOINER+this.TEXT_LAST;}};NYX.PageSelect=function(parent){this.parent=parent;this.DEFAULT_OPTION_TEXT="Jump to:";this.getHTML=function(){var wrapper=document.createElement("ins");var ctrl=document.createElement("select");ctrl.className=this.parent.CSS_CLASS_SELECT;var option=document.createElement("option");option.innerHTML=this.DEFAULT_OPTION_TEXT;ctrl.appendChild(option);for(var pageIdx=1;pageIdx<=this.parent.pageCount;pageIdx++){option=document.createElement("option");option.innerHTML=pageIdx;ctrl.appendChild(option);}
wrapper.appendChild(ctrl);var eventCode="if (this.selectedIndex != "+this.parent.currentPage+" && this.selectedIndex > 0) "+
"location.search = NYX.util.querystring.set(pageVarName, this.selectedIndex);"+
"else this.selectedIndex = 0;";eventCode=eventCode.replace("pageVarName",'"'+this.parent.pageVarName+'"');wrapper.innerHTML=wrapper.innerHTML.replace("<select","<select onchange='"+eventCode+"' ");return wrapper.innerHTML;};};
NYX.cache.userIsLoggedIn=false;NYX.CommentOutput=function(idRoot,itemTemplate){NYX.util.obj.extend(this,NYX.TemplateTool);this.idRoot=idRoot;if(typeof itemTemplate=="string"){this.template=itemTemplate;}
else{this.template="@Nyx.PageTitle@";}
this.pager=null;this.comments=[];this.DOM_TARGET_SUFFIX_COUNT="count";this.DOM_TARGET_SUFFIX_SORT="sort";this.DOM_TARGET_SUFFIX_HEADER="header";this.prepareData=function(commentObj){for(var i in commentObj.Author){commentObj["Author"+i]=commentObj.Author[i];}
commentObj.AuthorKey=commentObj.Author.UserKey.Key;commentObj.CommentIDKey=commentObj.CommentKey.Key;commentObj.CommentIDKey=commentObj.CommentIDKey.replace(/CommentKey\:/,"");commentObj.FilteredAuthorName=commentObj.AuthorDisplayName;commentObj.FilteredAuthorName=commentObj.FilteredAuthorName.replace(/\\/g,"\\\\");commentObj.FilteredAuthorName=commentObj.FilteredAuthorName.replace(/\'/g,"\\\'");commentObj.FilteredAuthorName=commentObj.FilteredAuthorName.replace(/\"/g,"\\\"");commentObj.CommentBody=commentObj.CommentBody.replace(/\r*\n/g,"<br>");commentObj.repliedToText="";commentObj.replyAnswerText=commentObj.CommentBody;if(commentObj.CommentBody.search(/("*Replying to \S+? \(\d+\/\d+\/\d+ \d+\:\d+\:\d+ \w\w\)\:.+?".+"\:)\s*(<br>)*/)!=-1){commentObj.repliedToText=commentObj.CommentBody;commentObj.repliedToText=commentObj.repliedToText.replace(/("*Replying to \S+? \(\d+\/\d+\/\d+ \d+\:\d+\:\d+ \w\w\)\:.+?".+"\:)\s*(<br>)*.*/,"<div class=\"commentRepliedInner\">$1</div>");commentObj.replyAnswerText=commentObj.replyAnswerText.replace(/("*Replying to \S+? \(\d+\/\d+\/\d+ \d+\:\d+\:\d+ \w\w\)\:.+?".+"\:)\s*(<br>)*/,"");}
return commentObj;};this.writeGui=function(daapiResponse){this.comments=daapiResponse.Comments;this.commentCount=Math.abs(daapiResponse.NumberOfComments);var commentData,itemIdx,html,targetElem;targetElem=this.getElem(this.DOM_TARGET_SUFFIX);if(targetElem!==null){this.initGui();document.standardTZDhours=(document.standardTZDhours)?document.standardTZDhours:-5;document.defaultDateFormat=(document.defaultDateFormat)?document.defaultDateFormat:'%m/%d/%Y %r';var modifier=(6+document.standardTZDhours)*3600000,pluckDate,modTest=(Date.prototype.toFormattedString&&(document.standardTZDhours!==-6||document.defaultDateFormat!='%m/%d/%Y %r'))?1:0;var abuseMsg='This comment has been hidden and is pending site review. Click here if you wish to view.';for(itemIdx=0;itemIdx<this.comments.length;itemIdx++){if(this.comments[itemIdx].Author.IsBlocked==='False'||NYX.cache.DisplayName==this.comments[itemIdx].Author.DisplayName){if(modTest===1){pluckDate=new Date(this.comments[itemIdx].PostedAtTime);this.comments[itemIdx].PostedAtTime=pluckDate.toFormattedString(document.defaultDateFormat);}
commentData=this.prepareData(this.comments[itemIdx]);html=this.processTemplate(commentData,this.template);if(this.comments[itemIdx].AbuseReportCount>2){html=html.replace(/<p([^>]*)>/ig,'<p$1 style="display:none;">');html=html.replace(/(div class=["']*pluckComOptions["']* style=["']*)/i,'$1display:none; ');html=html.replace(/<p /i,'<p class="abuseMsg" style="cursor:pointer;">'+abuseMsg+'<'+'/p><p ');}
html=this.applyAltClasses(itemIdx,html);html=this.showRecommends(html,commentData,itemIdx);html=this.showAbuse(html,commentData,itemIdx);html=this.customizeItem(commentData,html,targetElem,itemIdx);targetElem.innerHTML+=html;}}
this.showCommentCount();this.setPageSort();this.setPaginationCtrl();this.finishGui();this.showTarget(targetElem);this.showElem(this.DOM_TARGET_SUFFIX_HEADER);$('.abuseMsg').click(function(e){$(e.target).parent().children('p').show('fast');$(e.target).hide('fast');$(e.target).parent().children('.pluckComOptions').show('fast');return false;});}};this.showCommentCount=function(){var targetElem=this.getElem(this.DOM_TARGET_SUFFIX_COUNT);if(targetElem!==null){var domain=(typeof mi!='undefined'&&typeof mi.media_domain!='undefined')?mi.media_domain:'';targetElem.innerHTML="Comment"+(this.commentCount==1?"":"s")+": <img src='"+domain+"/static/images/pluck/comment.gif' /> "+this.commentCount;}};this.setPageSort=function(){var targetElem=this.getElem(this.DOM_TARGET_SUFFIX_SORT);if(targetElem!==null&&typeof NYX.cache.commentSort=="string"){targetElem.value=NYX.cache.commentSort;}};this.setPaginationCtrl=function(){if(this.pager!==null){this.pager.totalItems=this.commentCount;this.pager.writeGui();}};this.showRecommends=function(template,dataObj,itemIdx){var recIdRoot,link,countElem,wrapper,reactionTool,alreadyDone,html,clickEventHtml;alreadyDone=(dataObj.CurrentUserHasRecommended.toLowerCase()=="true");recIdRoot=this.idRoot+"_rec_"+itemIdx;reactionTool=new NYX.Recommender(recIdRoot,"Comment",dataObj.CommentKey.Key);reactionTool.alreadyDone=alreadyDone;NYX.cache[recIdRoot+"_recommender"]=reactionTool;if(alreadyDone){link=document.createElement("span");link.innerHTML=reactionTool.stateStrings.done;link.className=" "+reactionTool.classNames.done;}else{link=document.createElement("a");link.href="#";link.innerHTML=reactionTool.stateStrings.notDone;link.className=" "+reactionTool.classNames.notDone;}
link.id=recIdRoot+"_link";countElem=document.createElement("span");countElem.className="nyxRecCount ";countElem.id=recIdRoot+"_recCount";countElem.innerHTML="&nbsp;("+dataObj.NumberOfRecommendations+")";wrapper=document.createElement("ins");wrapper.appendChild(link);wrapper.appendChild(countElem);clickEventHtml="NYX.cache['"+recIdRoot+"_recommender'].recommend()";html=wrapper.innerHTML;html=html.replace('href="#"','href="javascript: void(0)" onclick="'+clickEventHtml+'"');template=template.replace("@Nyx.Recommender@",html);return template;};this.showAbuse=function(template,dataObj,itemIdx){var abuseIdRoot,link,img,wrapper,reactionTool,alreadyReported,html,clickEventHtml;alreadyReported=(dataObj.CurrentUserHasReportedAbuse.toLowerCase()=="true");abuseIdRoot=this.idRoot+"_abuse_"+itemIdx;reactionTool=new NYX.AbuseReporter(abuseIdRoot,"Comment",dataObj.CommentKey.Key);reactionTool.alreadyDone=alreadyReported;NYX.cache[abuseIdRoot+"_reporter"]=reactionTool;if(alreadyReported){link=document.createElement("span");link.innerHTML=reactionTool.stateStrings.done;}else{link=document.createElement("a");link.href="#";link.innerHTML=reactionTool.stateStrings.notDone;}
link.className="nyxAbuseReport";link.id=abuseIdRoot+"_link";img=document.createElement("img");img.className="nyxAbuseReport";img.id=abuseIdRoot+"_img";if(alreadyReported){img.src=NYX.cache.iconRoot+"/icon_"+reactionTool.imageNames.done+".gif";img.className+=" "+reactionTool.classNames.done;}else{img.src=NYX.cache.iconRoot+"/icon_"+reactionTool.imageNames.notDone+".gif";img.className+=" "+reactionTool.classNames.notDone;}
wrapper=document.createElement("ins");wrapper.appendChild(img);wrapper.appendChild(link);clickEventHtml="NYX.cache['"+abuseIdRoot+"_reporter'].positionAndShowForm(event)";html=wrapper.innerHTML;html=html.replace('href="#"','href="javascript: void(0)" onclick="'+clickEventHtml+'"');template=template.replace("@Nyx.AbuseReporter@",html);return template;};this.initGui=function(){return true;};this.finishGui=function(){return true;};this.customizeItem=function(dataObj,itemHtml,domElemThisWritesTo,itemIndex){return itemHtml;};};NYX.Reactor={This:this,msg_saveError:"Sorry, an unexpected error occurred. Please try your action again.",form:null,alreadyDone:false,getForm:function(){if(this.form===null){this.form=document.getElementById(this.FORM_ID);}
return this.form;},showForm:function(){var form=this.getForm();form.style.display="block";form.reporter=this;},hideForm:function(){this.form.style.display="none";},positionAndShowForm:function(theEvent){ShowDivAtMouse(theEvent,this.FORM_ID);this.showForm();}};NYX.Recommender=function(guiIdRoot,itemType,itemId){var This=this;NYX.util.obj.extend(this,NYX.Reactor);this.guiIdRoot=guiIdRoot;this.keyType=itemType;this.itemId=itemId;this.stateStrings={notDone:"Recommend",done:"Recommended"};this.classNames={notDone:"SiteLife_Recommend",done:"SiteLife_Recommended"};this.recommend=function(){if(!this.alreadyDone){var requestBatch,daapiAction,theKey;theKey=eval('new '+this.keyType+'Key("'+this.itemId+'")');requestBatch=new RequestBatch();daapiAction=new RecommendAction(theKey);requestBatch.AddToRequest(daapiAction);requestBatch.BeginRequest(NYX.cache.daapiProcessUrl,this.callback);}};this.callback=function(responseBatch){if(responseBatch.Messages[0].Message.toLowerCase()=="ok"){This.setDoneState();}else{alert(This.msg_saveError);console.dir(responseBatch);}};this.setDoneState=function(){this.alreadyDone=true;var anchorTag,countTag,currentCount;anchorTag=document.getElementById(this.guiIdRoot+"_link");anchorTag.className=anchorTag.className.replace(this.classNames.notDone,this.classNames.done);anchorTag.innerHTML=this.stateStrings.done;countTag=document.getElementById(this.guiIdRoot+"_recCount");currentCount=Math.abs(countTag.innerHTML.substring(countTag.innerHTML.length-2,countTag.innerHTML.length-1));countTag.innerHTML="&nbsp;("+ ++currentCount+")";};};NYX.AbuseReporter=function(guiIdRoot,itemType,itemId){var This=this;NYX.util.obj.extend(this,NYX.Reactor);this.guiIdRoot=guiIdRoot;this.keyType=itemType;this.itemId=itemId;this.msg_saveError="Sorry, an unexpected error occurred. Please try your abuse report again.";this.stateStrings={notDone:"Report abuse",done:"Abuse reported"};this.FORM_ID="nyxAbuseRptForm";this.imageNames={notDone:"alert",done:"accept"};this.classNames={notDone:"reportable",done:"reported"};this.report=function(){if(!this.alreadyDone){var requestBatch,daapiAction,theKey;theKey=eval('new '+this.keyType+'Key("'+this.itemId+'")');requestBatch=new RequestBatch();daapiAction=new ReportAbuseAction(theKey,document.getElementById(this.FORM_ID+"_reason").value,document.getElementById(this.FORM_ID+"_comment").value);requestBatch.AddToRequest(daapiAction);requestBatch.BeginRequest(NYX.cache.daapiProcessUrl,this.callback);this.hideForm();}};this.callback=function(responseBatch){if(responseBatch.Messages[0].Message.toLowerCase()=="ok"){This.setDoneState();}else{alert(This.msg_saveError);This.positionAndShowForm();console.dir(responseBatch);}};this.setDoneState=function(){this.alreadyDone=true;var imgTag,anchorTag;imgTag=document.getElementById(this.guiIdRoot+"_img");imgTag.src=imgTag.src.replace(this.imageNames.notDone,this.imageNames.done);imgTag.className=imgTag.className.replace(this.classNames.notDone,this.classNames.done);anchorTag=document.getElementById(this.guiIdRoot+"_link");anchorTag.innerHTML=this.stateStrings.done;};};function colorReplies(retryNum)
{var changed=false;$(".pluckCommentBody").attr("innerHTML",function(){if(isReply(this.innerHTML)){changed=true;return this.innerHTML.replace(/("*Replying to \S+? \(\d+\/\d+\/\d+ \d+\:\d+\:\d+ \w\w\)\:.+?".+"\:)\s*(<br>)*/,"<table border=0 class=\"pluckReplyTable\"><tr><td class=\"pluckReplyInComment\">$1<"+"/td><"+"/tr><"+"/table>");}
else{return this.innerHTML;}});if(!(changed)&&retryNum>0){retryNum--;setTimeout("colorReplies("+retryNum+")",2000);}}
function isReply(commentText)
{if(commentText.search(/Replying to \S+? \(\d+\/\d+\/\d+ \d+\:\d+\:\d+ \w\w\)\:/)==-1){return false;}
return true;}
function hideReplyNotLoggedIn()
{if(!(gSiteLife.mi.userLoggedIn())){$(".Discussion_PostReply").css("display","none");}}
function showReplyLoggedIn()
{if(gSiteLife.mi.userLoggedIn()){$(".Discussion_PostReply").css("display","inline");}}
function commentReply(commentID,replyToName,origTime,truncateTo)
{var replyText="Replying to "+replyToName+" ("+origTime+"):<br>";var fromText=$("#"+commentID).html();fromText=fromText.replace(/[\r\n]/g,"");fromText=fromText.replace(/<div class="commentRepliedInner">Replying to.+?M\):<br>"/i,"");fromText=fromText.replace(/":<\/div>/i,"");if(fromText.length>truncateTo){var spaceIndex=fromText.lastIndexOf(' ',truncateTo);if(spaceIndex<fromText.lastIndexOf("\n",truncateTo)){spaceIndex=fromText.lastIndexOf("\n",truncateTo);}
fromText=fromText.substring(0,spaceIndex)+"...";}
replyText+="\""+fromText+"\":<br>";var fromTextCR=fromText.replace(/<br>/gi,"\n");var matches=fromTextCR.match(/\r|\n/g);if(!matches){NYX.cache.commentReplyLength=fromTextCR.length;}
else{NYX.cache.commentReplyLength=fromTextCR.length-matches.length;}
NYX.cache.max_comment_length=NYX.cache.init_max_comment_length-NYX.cache.commentReplyLength;var commentMsg=document.getElementById('commentTopMsg');commentMsg.innerHTML="<br><a id=\"link_back_from_reply\" href=\"#commentlink"+commentID+"\" onclick=\"cancelCommentReply()\" class=\"cancelReplyLink\">Cancel Reply</a>";commentMsg.innerHTML+="<br>";var commentTarget=document.getElementById('commentTopReply');commentTarget.innerHTML=replyText;var commentTextArea=document.getElementById('commentBody');commentTextArea.focus();checkCommentLength(document.getElementById("commentBody"));return false;}
function cancelCommentReply()
{var commentMsg=document.getElementById('commentTopMsg');commentMsg.innerHTML="";var commentTarget=document.getElementById('commentTopReply');commentTarget.innerHTML="";NYX.cache.commentReplyLength=0;NYX.cache.max_comment_length=NYX.cache.init_max_comment_length;checkCommentLength(document.getElementById("commentBody"));}
function addReplyToComment()
{var replyToComment=document.getElementById('commentTopReply');var replyToText=replyToComment.innerHTML;if(replyToText!==""){replyToText=replyToText.replace(/[\r\n]/g,"");replyToText=replyToText.replace(/<br>/gi,"\n");replyToText=replyToText.replace(/<span.+?>/i,"");replyToText=replyToText.replace(/<\/span>/i,"");replyToText=replyToText.replace(/<\/*table.*?>/gi,"");replyToText=replyToText.replace(/<\/*tr.*?>/gi,"");replyToText=replyToText.replace(/<\/*td.*?>/gi,"");replyToText=replyToText.replace(/<\/*td.*?>/gi,"");replyToText=replyToText.replace(/<\/*tbody.*?>/gi,"");replyToText=replyToText.replace(/<\/*div.*?>/gi,"");var matches=replyToText.match(/\r|\n/g);if(!matches){NYX.cache.commentReplyLength=replyToText.length;}
else{NYX.cache.commentReplyLength=replyToText.length-matches.length;}
NYX.cache.max_comment_length=NYX.cache.init_max_comment_length-NYX.cache.commentReplyLength;var commentTarget=document.getElementById('commentBody');var commentText=$("#commentBody").html();if(commentText===null){commentText="";}
if(typeof(commentTarget.value)!="undefined"){if(commentTarget.value!==""&&commentTarget.value!==null){commentText=commentTarget.value;}}
commentText=replyToText+commentText;commentTarget.innerText=commentText;commentTarget.textContent=commentText;commentTarget.value=commentText;}
return true;}
function stripReplyText()
{var commentTarget=document.getElementById('commentBody');var commentText=$("#commentBody").html();if(commentText===null){commentText="";}
if(typeof(commentTarget.value)!="undefined"){if(commentTarget.value!==""&&commentTarget.value!==null){commentText=commentTarget.value;}}
if(isReply(commentText)){commentText=commentText.replace(/\r?\n/g,"#zxyqj");commentText=commentText.replace(/Replying to \S+? \(\d+\/\d+\/\d+ \d+\:\d+\:\d+ \w\w\)\:.+?".+?"\:(#zxyqj)*/,"");commentText=commentText.replace(/\#zxyqj/g,"\n");}
commentTarget.innerText=commentText;commentTarget.textContent=commentText;commentTarget.value=commentText;}
function commentReplyInit()
{showReplyLoggedIn();colorReplies(20);}
