
NYX.cache.daapiProcessUrl=serverUrl;switch(document.domain){case'charlotteobserver.com':case'macon.com':case'bradenton.com':case'sunherald.com':if(typeof thisArticlePubDate!='undefined'&&thisArticlePubDate){var pubDate=new Date(thisArticlePubDate),fixDate=new Date('September 11, 2008 12:00 PM');thisArticleId=(pubDate.getTime()>fixDate.getTime())?document.domain+'_'+thisArticleId:thisArticleId;}
break;case'thesunnews.com':thisArticleId='myrtlebeachonline.com_'+thisArticleId;break;default:thisArticleId=document.domain+'_'+thisArticleId;}
thisArticleUrl=thisArticleUrl.replace(/\/v-[^\/]+/,'');var thisArticleKey=new ArticleKey(thisArticleId);var commentsPerPage=(typeof mi_comments_per_page=='undefined'||mi_comments_per_page>10)?10:(mi_comments_per_page<3)?3:mi_comments_per_page;var numOfRecommends=0;var currentCommentPage=NYX.util.querystring.get("pageNum");if(currentCommentPage===null){currentCommentPage=1;}
var qsParamForSorting="commentSort";NYX.cache.commentSort=NYX.util.querystring.get(qsParamForSorting);if(NYX.cache.commentSort===null)
{if(typeof mi_comment_sort_preference!='undefined'){switch(mi_comment_sort_preference){case'TimeStampAscending':case'TimeStampDescending':case'RecommendationsDescending':case'RecommendationsAscending':NYX.cache.commentSort=mi_comment_sort_preference;break;default:NYX.cache.commentSort='TimeStampDescending';}}else{NYX.cache.commentSort='TimeStampDescending';}}
function sortComments(criterion){var newQuerystring=NYX.util.querystring.set(qsParamForSorting,criterion,location.search);newQuerystring=NYX.util.querystring.set("pageNum",1,newQuerystring);location.search=newQuerystring;}
function daapiCallback(responseBatch){NYX.fixConsole();console.dir(responseBatch);myGadgetAva.writeGui(responseBatch.Responses[0].User);NYX.cache.DisplayName=responseBatch.Responses[0].User.DisplayName;var respIdx;if(!responseBatch.Responses[1].Article){var articlePath=thisArticleUrl.replace(/^(http:\/\/)?[^\.]*\.*[^\.]+\.[^\/]+(\/.*)$/,'$2');var origin=NYX.cache.iconRoot.replace(/^http:\/\/([^\/]+)\/.*/,'$1');responseBatch.Responses[2]=responseBatch.Responses[1];responseBatch.Responses[1]={'Article':{'ArticleKey':new ArticleKey(thisArticleId),'Categories':[],'Comments':{'NumberOfComments':0},'PageTitle':thisArticleTitle,'PageUrl':'http://'+location.hostname+articlePath,'Ratings':{'AverageRating':'0','CurrentUserRating':'0','NumberOfRatings':'0'},'Recommendations':{'CurrentUserHasRecommended':'False','NumberOfRecommendations':'0'},'Reviews':{'NumberOfReviews':'0'},'Section':{'Name':thisArticleSection},'SiteOfOrigin':origin}};}
if(responseBatch.Responses[1].Article.Recommendations.NumberOfRecommendations){numOfRecommends=responseBatch.Responses[1].Article.Recommendations.NumberOfRecommendations;var recDiv=document.getElementById('recommendation');var comCount=document.getElementById('commentsCount');if(recDiv&&comCount){comCount.innerHTML=responseBatch.Responses[2].CommentPage.NumberOfComments;if(responseBatch.Responses[1].Article.Recommendations.CurrentUserHasRecommended=="False"){recDiv.innerHTML="<a href='#none' onClick='artRecommend();'><img src='"+NYX.cache.iconRoot+"arrow_up_rec.gif' /> Recommend</a> ("+responseBatch.Responses[1].Article.Recommendations.NumberOfRecommendations+")";}else{recDiv.innerHTML="<img src='"+NYX.cache.iconRoot+"icon_accept.gif' /> Recommended ("+responseBatch.Responses[1].Article.Recommendations.NumberOfRecommendations+")";}}}
for(respIdx=0;respIdx<responseBatch.Responses.length;respIdx++){var thisResponse=responseBatch.Responses[respIdx];if(typeof thisResponse.User=="object"){if(thisResponse.User.UserTier.toLowerCase()!="anonymous"){NYX.cache.userIsLoggedIn=true;}}else if(typeof thisResponse.CommentPage=="object"){outputGadget.writeGui(thisResponse.CommentPage);}}}
var myGadgetAva=new NYX.CurrentUser("AvatarOutput");var requestBatch=new RequestBatch();requestBatch.AddToRequest(new UserKey());requestBatch.AddToRequest(thisArticleKey);requestBatch.AddToRequest(new CommentPage(thisArticleKey,commentsPerPage,currentCommentPage,NYX.cache.commentSort));function artRecommend(){requestBatch=new RequestBatch();var articlePath=thisArticleUrl.replace(/^(http:\/\/)?[^\.]*\.*[^\.]+\.[^\/]+(\/.*)$/,'$2');requestBatch.AddToRequest(new UpdateArticleAction(thisArticleKey,'http://'+location.hostname+articlePath,thisArticleTitle,new Section(thisArticleSection),[new Category(thisArticleCatagory)]));requestBatch.AddToRequest(new RecommendAction(thisArticleKey));requestBatch.BeginRequest(serverUrl,RecommendSubmitted);}
function RecommendSubmitted(responseBatch){if(responseBatch.Messages[0].Message=='ok'){document.getElementById('recommendation').innerHTML="<img src='"+NYX.cache.iconRoot+"icon_accept.gif' /> Recommended ("+ ++numOfRecommends+")";}else{alert(responseBatch.Messages[0].Message);}}
NYX.CommentInput=function(idRoot,articleKey){this.idRoot=idRoot;this.MAX_COMMENT_LENGTH=1000;NYX.cache.max_comment_length=this.MAX_COMMENT_LENGTH;NYX.cache.init_max_comment_length=this.MAX_COMMENT_LENGTH;NYX.cache.commentReplyLength=0;this.getTrueMaxLength=function(){return this.MAX_COMMENT_LENGTH-5;};this.makeHTML=function(){NYX.cache.articlePath=thisArticleUrl.replace(/^(http:\/\/)?[^\.]*\.*[^\.]+\.[^\/]+(\/.*)$/,'$2');var theForm=document.createElement("form");theForm.id=idRoot+"_inputForm";theForm.action="#";theForm.method='post';theForm.style.display='inline';var addHeading=document.createElement("div");if(gSiteLife.mi.userLoggedIn()){addHeading.className='Comments_AddHeading';addHeading.appendChild(document.createTextNode('Add a comment '));var elmRef=addHeading.appendChild(document.createElement('span'));elmRef.className='Comments_MaxLengthText';elmRef.appendChild(document.createTextNode('(max '+this.MAX_COMMENT_LENGTH+' characters)'));}else{addHeading.className='SiteLife_Login';addHeading.id='SiteLife_Login';addHeading.appendChild(document.createTextNode('You must be logged in to leave a comment. '));elmRef=addHeading.appendChild(document.createElement('a'));elmRef.href='/static/insite/login.html?goto='+window.location.href;elmRef.appendChild(document.createTextNode('Login'));addHeading.appendChild(document.createTextNode(' | '));elmRef=addHeading.appendChild(elmRef.cloneNode(false));elmRef.href='/reg-bin/int.cgi?mode=register&goto='+window.location.href;elmRef.appendChild(document.createTextNode('Register'));}
$(addHeading).prepend('<div class="Sitelife_PluckLogo"><a target="_blank" href="http://www.pluck.com"><img src="http://pluck.'+document.domain+'/ver1.0/Content/images/poweredbypluck.gif" style="border: 0px none ;"/></a></div>');elmRef=addHeading.appendChild(elmRef.cloneNode(false));elmRef.id='CommentError';elmRef.className='Comments_Error';var commentTopMsg=addHeading.appendChild(document.createElement('span'));commentTopMsg.id='commentTopMsg';commentTopMsg.className='commentTop_Msg';var commentTopReply=addHeading.appendChild(document.createElement('span'));commentTopReply.id='commentTopReply';commentTopReply.className='commentTop_Reply';theForm.appendChild(addHeading);var addTextArea=addHeading.cloneNode(false);addTextArea.className='Comments_AddTextarea';addTextArea.id='';var textArea=addTextArea.appendChild(document.createElement("textarea"));textArea.id='commentBody';$(textArea).bind('keyup',function(){checkCommentLength(document.getElementById("commentBody"));});textArea.disabled=(gSiteLife.mi.userLoggedIn())?false:'true';var filterMsg=addTextArea.appendChild(addHeading.cloneNode(false));filterMsg.className='SiteLife_Filtered';filterMsg.id='';theForm.appendChild(addTextArea);var commentsSubmit=addTextArea.cloneNode(false);commentsSubmit.className='Comments_Submit';commentsSubmit.id='';var theButton=document.createElement("input");theButton.type="submit";theButton.value="Submit";theButton.id="comment_submit_button";theButton.disabled=(gSiteLife.mi.userLoggedIn())?false:'true';commentsSubmit.appendChild(theButton);theForm.appendChild(commentsSubmit);$(theForm).bind('submit',this.submit);$('#Comments_Container').prepend(theForm);};this.submit=function(){if(document.getElementById("commentBody").value.trim()===""){document.getElementById("CommentError").innerHTML=" * Please provide a comment.";return false;}else{addReplyToComment();$('.Comments_Submit input[type=submit]').attr({disabled:true});checkCommentLength(document.getElementById("commentBody"));var pageUrl='http://'+location.hostname+NYX.cache.articlePath;requestBatch=new RequestBatch();requestBatch.AddToRequest(new CommentAction(thisArticleKey,pageUrl,thisArticleTitle,document.getElementById('commentBody').value));requestBatch.AddToRequest(new UpdateArticleAction(thisArticleKey,'http://'+location.hostname+NYX.cache.articlePath,thisArticleTitle,new Section(thisArticleSection),[new Category(thisArticleCatagory)]));requestBatch.BeginRequest(serverUrl,commentSubmitted);}
return false;};};checkCommentLength=function(textbox){if(textbox.value.length>NYX.cache.max_comment_length){textbox.value=textbox.value.substring(0,NYX.cache.max_comment_length);document.getElementById("CommentError").innerHTML=" * Your comment has been truncated to meet the character limit.";}else{document.getElementById("CommentError").innerHTML="";}};commentSubmitted=function(responseBatch){NYX.fixConsole();if(responseBatch.Messages[0].Message=="ok"){location=gSiteLife.mi.commenting.submitReturnAddress;}else if(responseBatch.Messages[0].Message.match('not permitted by our language filter')){var obscenities=responseBatch.Messages[0].Message.replace(/^.+for example: ([^\)]+).+$/,'$1');commentErrorProcess('Please edit or remove the following word(s), then resubmit your comments: '+obscenities+'.',true);}else if(responseBatch.Messages[0].Message.match('rapid posting of multiple comments')){commentErrorProcess('We restrict the rapid posting of comments.  Please wait 15 seconds before submitting again.',true);}else{$('.comWrapper .SiteLife_Filtered').empty().append((typeof CommentTechProbMsg!='undefined')?CommentTechProbMsg:'Commenting is currently experiencing temporary technical difficulties. We value your input, please try submitting your comment later. We apologize for the inconvenience.');}};commentErrorProcess=function(errorMsg,submitOK){stripReplyText();$('.comWrapper .SiteLife_Filtered').empty().append(errorMsg);if(submitOK){$('.Comments_Submit input[type=submit]').attr({disabled:false});}};NYX.commentingInit=function(){if(sitelife_is_on&&siteLife_master_switch_on){$(document).ready(function(){var commentInput=new NYX.CommentInput('commenting');commentInput.makeHTML();commentTempl=(document.getElementById("commentOutputTemplate"))?document.getElementById("commentOutputTemplate").innerHTML:'';window.outputGadget=new NYX.CommentOutput("nyxComments",commentTempl);window.outputGadget.pager=new NYX.Pager({pageLength:commentsPerPage,template:"More comments on this story: @Nyx.pageLinks@",domTargetElem:document.getElementById("nyxComments_pager"),linkLimit:10});myGadgetAva.userTemplate=(document.getElementById("userTemplate"))?document.getElementById("userTemplate").innerHTML:'';myGadgetAva.guestTemplate=(document.getElementById("anonTemplate"))?document.getElementById("anonTemplate").innerHTML:'';function pluckCallToAction(){requestBatch.BeginRequest(serverUrl,daapiCallback);}
new NYX.ieSafeExecution(pluckCallToAction).execute();});}};