var articleIdsArray=new Array();var commentSubmitted=false;var global_abuseReportKeyValue=null;var global_abuseReportObjectType=null;function appendToArticleIdsArray(articleId,type){var articleIdExists=false;var passedIdSubArray=new Array(articleId.toLowerCase(),type);for(var i=0;i<articleIdsArray.length;i++){if(articleId==articleIdsArray[i][0]&&type==articleIdsArray[i][1]){articleIdExists=true}}if(!articleIdExists){articleIdsArray.push(passedIdSubArray)}}function submitRequest(){var requestBatch=new RequestBatch();var count=0;var submittedArticles=new Array();for(var i=0;i<articleIdsArray.length;i++){if(count==20){requestBatch.BeginRequest(sitelifeServerURL,pluckCallBack);requestBatch=new RequestBatch();count=0}var articleKey=new ArticleKey(articleIdsArray[i][0]);if(0<articleIdsArray[i][1].indexOf("-body-comments-")){var commentPage=new CommentPage(articleKey,5,1,"TimeStampDescending");requestBatch.AddToRequest(commentPage);count++}else{if(0<articleIdsArray[i][1].indexOf("-comments-")){var commentPage=new CommentPage(articleKey,10,1,"TimeStampDescending");requestBatch.AddToRequest(commentPage);count++}else{var isBatched=false;for(var j=0;j<submittedArticles.length&&isBatched==false;j++){if(articleIdsArray[i][0]==submittedArticles[j]){isBatched=true}}if(isBatched==false){submittedArticles.push(articleIdsArray[i][0]);requestBatch.AddToRequest(articleKey);count++}}}}requestBatch.BeginRequest(sitelifeServerURL,pluckCallBack)}function submitCommentPageRequest(pageNo,moduleId,assetId){var requestBatch=new RequestBatch();var articleKey=new ArticleKey(articleIdsArray[0][0]);var commentPage=new CommentPage(articleKey,5,pageNo,"TimeStampDescending");requestBatch.AddToRequest(commentPage);requestBatch.BeginRequest(sitelifeServerURL,pluckPageRequestCallBack)}function pluckCallBack(responseBatch){var response;for(var i=0;i<responseBatch.Responses.length;i++){response=responseBatch.Responses[i];if(null!=response.CommentPage){processCommentPage(response.CommentPage)}else{if(null!=response.Article){processArticle(response.Article)}}}}function pluckPageRequestCallBack(responseBatch){var response;for(var i=0;i<responseBatch.Responses.length;i++){response=responseBatch.Responses[i];if(null!=response.CommentPage){processCommentPage(response.CommentPage)}}}function processArticle(article){var tag;for(var i=0;i<articleIdsArray.length;i++){if(articleIdsArray[i][0]==article.ArticleKey.Key.toLowerCase()){tag=document.getElementById(articleIdsArray[i][1]);if(0<articleIdsArray[i][1].indexOf("-votes-")){tag.innerHTML=article.Recommendations.NumberOfRecommendations}else{if(0<articleIdsArray[i][1].indexOf("-commentCount-")){tag.innerHTML=article.Comments.NumberOfComments}}}}}function processCommentPage(commentPage){for(var i=0;i<articleIdsArray.length;i++){if(articleIdsArray[i][1].indexOf("-body-comments-")>0){if(articleIdsArray[i][0]==commentPage.ArticleKey.Key.toLowerCase()){writeCommentPageHTML(articleIdsArray[i][1],commentPage,commentPage.ArticleKey.Key)}}else{if(articleIdsArray[i][1].indexOf("-comments-")>0){if(articleIdsArray[i][0]==commentPage.ArticleKey.Key.toLowerCase()){writeCommentHTML(articleIdsArray[i][1],commentPage,commentPage.ArticleKey.Key)}}}}}function submitCommentToPluck(assetId,href,title){var cmt=document.getElementById("comment-box").value;cmt=cleanHTMLTags(cmt);var commentAction=new CommentAction(new ArticleKey(assetId),href,title,cmt);var requestBatch=new RequestBatch();requestBatch.AddToRequest(commentAction);requestBatch.BeginRequest(sitelifeServerURL,commentSubmitted);setTimeout("sendToHomePage()",500);return false}function sendToHomePage(){var qStart=window.location.href.lastIndexOf("?");var url=window.location.href;var sUrl;if(qStart!=-1){sUrl=url.substring(0,qStart);window.location.href=sUrl}else{window.location.href=url}}function escapeQuotes(str){noquotes=/\'|"/g;return str.replace(noquotes,"\\'")}function commentSubmitted(responseBatch){if(responseBatch.Messages[0].Message=="ok"){document.getElementById("comment-box").value="";submitRequest()}}function recommend(assetID){var requestBatch=new RequestBatch();requestBatch.AddToRequest(new RecommendAction(new ArticleKey(assetID)));requestBatch.BeginRequest(sitelifeServerURL,recommendSubmitted)}function recommendSubmitted(responseBatch){var ctl=document.getElementById("recommend");ctl.innerHTML='<img src="/images/social-networking-bar/thank-you-for-voting.png" alt="thank you for voting" />';submitRequest()}function recommendComment(commentKey){var requestBatch=new RequestBatch();requestBatch.AddToRequest(new RecommendAction(new CommentKey(commentKey)));requestBatch.BeginRequest(sitelifeServerURL,recommendCommentResponse)}function recommendCommentResponse(responseBatch){if(responseBatch.Messages[0].Message=="ok"){submitRequest()}else{alert(responseBatch.Messages[0].Message)}}function cleanHTMLTags(_string){var clean=_string.replace(/<[^>]*>/,"");if(clean.match("<")||clean.match(">")){clean=cleanHTMLTags(clean)}return clean}function reportAbuseResponse(responseObject){if(responseObject.Messages.length>0&&responseObject.Messages[0].Message=="ok"){}else{}}function reportAbuseOpen(event,offsetX,offsetY,abuseReportKeyValue,abuseReportObjectType){global_abuseReportKeyValue=null;global_abuseReportObjectType=null;global_abuseReportKeyValue=abuseReportKeyValue;global_abuseReportObjectType=abuseReportObjectType;if(global_abuseReportKeyValue&&global_abuseReportObjectType){showElementById("report-abuse-comment-box",event,offsetX,offsetY);document.reportAbuseForm.reportAbuseReason.selectedIndex=0;document.getElementById("report-abuse-description").value=""}}function reportAbuseClose(){hideElementById("report-abuse-comment-box")}function reportAbuseSubmit(){var key=global_abuseReportKeyValue;var type=global_abuseReportObjectType;var abuseDescription=document.getElementById("report-abuse-description").value;abuseDescription=cleanHTMLTags(abuseDescription);var abuseReason=document.reportAbuseForm.reportAbuseReason.options[document.reportAbuseForm.reportAbuseReason.selectedIndex].value;if(abuseReason!=""){reportAbuseClose();var keyType=null;if(type=="comment"){keyType=new CommentKey(key)}else{if(type=="article"){keyType=new ArticleKey(key)}else{if(type=="review"){keyType=new ReviewKey(key)}}}var requestBatch=new RequestBatch();requestBatch.AddToRequest(new ReportAbuseAction(keyType,abuseReason,abuseDescription));requestBatch.BeginRequest(sitelifeServerURL,reportAbuseResponse)}else{alert("Please select the reason for which you are reporting abuse.")}}function writeCommentHTML(moduleId,commentPage,assetId){var commentBlock=document.getElementById(moduleId);var commentModuleHTML="";var comLimit=3;var currentUsersId;if(personCookieValue&&userCookieValue&&contextCookieValue){currentUsersId=userCookieArray[4]}if(0<commentPage.NumberOfComments){commentModuleHTML+='<div class="total-count arrow-plain">';commentModuleHTML+='<p><strong class="number"><span class="curly-brace">';commentModuleHTML+='{</span><span class="comments-count">';commentModuleHTML+=commentPage.NumberOfComments;commentModuleHTML+='</span><span class="curly-brace">}</span></strong> people have commented on this article</p>';commentModuleHTML+="</div>";commentModuleHTML+='<dl class="posted-comments clear clearfix">';for(var i=0;i<commentPage.Comments.length&&i<comLimit;i++){if(commentPage.Comments[i].Author.IsBlocked=="False"||(preAuthenticated&&commentPage.Comments[i].Author.UserKey.Key==currentUsersId)){commentModuleHTML+=writePostedBubbleHTML(commentPage.Comments[i])}else{comLimit+=1}}commentModuleHTML+="</dl>"}else{if(true==loggedIn&&true==preAuthenticated){commentModuleHTML+='<div class="sans-comments arrow-plain">';commentModuleHTML+='<h4 class="call-to-action">Have something important to say? Post your comment.</h4>';commentModuleHTML+='<div class="post">';commentModuleHTML+='<div class="photo"><p><img src="'+currentUsersAvatar+'" alt="'+currentUsersProperName+'" /></p></div>';commentModuleHTML+='<div class="details">';commentModuleHTML+='<img src="/images/modules/in-context/post-bubble-top.gif" alt="post bubble top" />';commentModuleHTML+='<div class="quote">';ArticleTitle=escapeQuotes(ArticleTitle);commentModuleHTML+='<form id="post-comment" action="/" onsubmit="return submitCommentToPluck(\''+assetId+"', '"+document.location.href+"', '"+ArticleTitle+"');\">";commentModuleHTML+="<p>";commentModuleHTML+='<label for="comment-box" class="none">Type a comment:</label>';commentModuleHTML+='<textarea name="comment-box" id="comment-box" class="comment-box" rows="4" cols="80"></textarea>';commentModuleHTML+='<label for="post-comment" class="none">Submit comment:</label>';commentModuleHTML+='<input type="image" name="post-button" id="post-button" src="/images/modules/in-context/buttons/post-comment.gif" alt="post a comment" class="post-button" />';commentModuleHTML+="</p>";commentModuleHTML+="</form>";commentModuleHTML+="</div>";commentModuleHTML+='<img src="/images/modules/in-context/post-bubble-bottom.gif" alt="post bubble bottom" />';commentModuleHTML+='<p class="name">'+currentUsersScreenname+"</p>";commentModuleHTML+="</div>";commentModuleHTML+='<p class="disclaimer">User comments may be used elsewhere on this site. Comments that include profanity, or personal attacks, or antisocial behavior such as "spamming" or "trolling," or other inappropriate comments or material will be removed from the site. We will take steps to block users who violate any of our terms of use. You are fully responsible for the content that you post.</p>';commentModuleHTML+='<p class="disclaimer">By posting on our site, you agree to comply with our terms of use.  <a href="http://corporate.discovery.com/utilities/about/visitoragreement.html#social">Please review the terms here.</a></p>';commentModuleHTML+="</div>";commentModuleHTML+="</div>"}else{commentModuleHTML+='<div class="sans-comments arrow-hued">';commentModuleHTML+='<h4 class="call-to-action">Have something important to say? Post your comment.</h4>';commentModuleHTML+='<div class="post">';commentModuleHTML+='<div class="photo"><p><img src="'+currentUsersAvatar+'" alt="'+currentUsersProperName+'" /></p></div>';commentModuleHTML+='<div class="details">';commentModuleHTML+='<img src="/images/modules/in-context/post-bubble-top.gif" alt="post bubble top" />';commentModuleHTML+='<div class="quote">';commentModuleHTML+='<form id="post-comment" action="/">';commentModuleHTML+="<p>";commentModuleHTML+='<label for="comment-box" class="none">Type a comment:</label>';commentModuleHTML+='<textarea name="comment-box" id="comment-box" class="comment-box" rows="4" cols="80" disabled="disabled" readonly="readonly">You must be logged in to post a comment.</textarea>';commentModuleHTML+="</p>";commentModuleHTML+="</form>";commentModuleHTML+='<div class="link-to-dora"><a href="javascript: void(null);" onclick="bounceToDORAUI(\'register\');"><img src="/images/modules/in-context/buttons/become-a-member.gif" alt="become a member" /></a> &#160; <a href="javascript: void(null);" onclick="bounceToDORAUI(\'login\');"><img src="/images/modules/in-context/buttons/log-in.gif" alt="log in" /></a></div>';commentModuleHTML+="</div>";commentModuleHTML+='<img src="/images/modules/in-context/post-bubble-bottom.gif" alt="post bubble bottom" />';commentModuleHTML+='<p class="name hidden">BLANK</p>';commentModuleHTML+='<p class="affiliate hidden">BLANK</p>';commentModuleHTML+="</div>";commentModuleHTML+='<p class="disclaimer">User comments may be used elsewhere on this site. Comments that include profanity, or personal attacks, or antisocial behavior such as "spamming" or "trolling," or other inappropriate comments or material will be removed from the site. We will take steps to block users who violate any of our terms of use. You are fully responsible for the content that you post.</p>';commentModuleHTML+='<p class="disclaimer">By posting on our site, you agree to comply with our terms of use.  <a href="http://corporate.discovery.com/utilities/about/visitoragreement.html#social">Please review the terms here.</a></p>';commentModuleHTML+="</div>";commentModuleHTML+="</div>"}}commentBlock.innerHTML=commentModuleHTML}function writeCommentPageHTML(moduleId,commentPage,assetId){var authorUserTier="";var commentBlock=document.getElementById(moduleId);var numComments=commentPage.NumberOfComments;var qStart=window.location.href.lastIndexOf("?");var qString;var pageNum;var currentUsersId;if(personCookieValue&&userCookieValue&&contextCookieValue){currentUsersId=userCookieArray[4]}if(qStart!=-1){qString=window.location.href.substr(qStart+1);pageNum=parseInt(qString.replace("page=",""));if(commentSubmitted==false){commentSubmitted=true;return submitCommentPageRequest(pageNum,moduleId,assetId)}}else{pageNum=1}var html='<div class="module-comments">';html+='<div class="runner">';html+='<div class="header"><p><img src="/images/modules/in-context/runners/comments-on-this-article.png" alt="comments on this article" class="png" /></p></div>';html+="</div>";for(var i=0;i<commentPage.Comments.length&&i<5;i++){if(commentPage.Comments[i].Author.IsBlocked=="False"||(preAuthenticated&&commentPage.Comments[i].Author.UserKey.Key==currentUsersId)){var commentKey="'"+commentPage.Comments[i].CommentKey.Key+"'";switch(commentPage.Comments[i].Author.UserTier){case"Editor":authorUserTier="Moderator";break;case"Featured":authorUserTier="Guest Contributor";break;case"Staff":authorUserTier="Planet Green Staff";break;case"Trusted":authorUserTier="Featured Member";break;default:authorUserTier="Planet Green Member"}if(i==0){html+='<div class="complete-comment arrow-hued">'}else{html+='<div class="complete-comment">'}html+='<div class="report">';html+='<a href="javascript:recommendComment('+commentKey+')">';html+="RECOMMEND COMMENT ("+commentPage.Comments[i].NumberOfRecommendations+")";html+="</a> | ";html+='<a href="javascript: void(null);" onclick="reportAbuseOpen(event, 195, 50, '+commentKey+", 'comment');\">";html+="REPORT ABUSE";html+="</a>";html+="</div>";html+='<div class="comment">';html+='<img src="/images/modules/in-context/comment-bubble-top.gif" alt="comment bubble top" />';html+='<div class="bubble">';html+='<p class="text">';html+=commentPage.Comments[i].CommentBody;html+="</p>";html+="</div>";html+='<img src="/images/modules/in-context/comment-bubble-bottom.gif" alt="comment bubble bottom" />';html+="</div>";html+='<dl class="member-info clear clearfix">';html+='<dd class="avatar">';html+='<a href="/accounts/persona.html?member='+commentPage.Comments[i].Author.UserKey.Key+'">';html+='<img src="'+commentPage.Comments[i].Author.AvatarPhotoUrl+'" alt="avatar" />';html+="</a>";html+="</dd>";html+='<dd class="summary">';html+='<p class="name">';html+='<a href="/accounts/persona.html?member='+commentPage.Comments[i].Author.UserKey.Key+'">';html+=commentPage.Comments[i].Author.DisplayName;html+="</a>";html+="</p>";html+='<p class="member-status">';html+=authorUserTier;html+="</p>";html+='<p class="post-time">';html+=processDateTime(commentPage.Comments[i].PostedAtTime);html+="</p>";html+="</dd>";html+="</dl>";html+="</div>"}}html+="</div>";html+=buildCommentPagination(numComments,moduleId,assetId,pageNum);html+=buildPostComment(assetId);commentBlock.innerHTML=html}function buildCommentPagination(numComments,moduleId,assetId,pageNum){var active="";var numLink="";var totalPages;var pages;var index;var i;var paginghtml="";totalPages=getTotalPages(numComments);index=totalPages-pageNum;pages=setStartEndPage(pageNum,totalPages,index);paginghtml+='<div id="listing-pagination">';paginghtml+='<div class="runner">';if(totalPages<=1){paginghtml+="</div>";paginghtml+="</div>";return paginghtml}paginghtml+='<ul class="row-data">';paginghtml+='<li class="back">';if(pageNum>1){paginghtml+='<a href="?page='+(pageNum-1)+'">';paginghtml+='<img src="/images/pagination/comments/back.png" alt="back" class="png" />';paginghtml+="</a>"}paginghtml+="</li>";for(i=pages[0];i<pages[1];i++){active="";numLink="";if(i==pageNum){active="active";numLink=i}else{numLink='<a href="?page='+i+'"> '+i+"</a>"}if(i!=totalPages){paginghtml+='<li class="number divider '+active+' ">'+numLink+"</li>"}else{paginghtml+='<li class="number '+active+' ">'+numLink+"</li>"}}paginghtml+='<li class="next">';if(pageNum!=totalPages){paginghtml+='<a href="?page='+(pageNum+1)+'">';paginghtml+='<img src="/images/pagination/comments/next.png" alt="next" class="png" />';paginghtml+="</a>"}paginghtml+="</li>";paginghtml+="</ul>";paginghtml+="</div>";paginghtml+="</div>";return paginghtml}function getTotalPages(numComments){var totPages;var numPerPage=5;var maxPages=9;totPages=Math.ceil(numComments/numPerPage);if(totPages>9){totPages=maxPages}return totPages}function setStartEndPage(pageNum,totalPages,index){var startPage;var lastPage;var maxPages=5;if(pageNum<=3){startPage=1;if(totalPages>5){lastPage=maxPages+1}else{lastPage=totalPages+1}}else{if(pageNum>3&&index>1){startPage=pageNum-2;lastPage=pageNum+3}else{if(pageNum>3&&index<=1){startPage=totalPages-4;lastPage=totalPages+1}}}return[startPage,lastPage]}function buildPostComment(assetId){var postCommentHTML="";if(true==loggedIn&&true==preAuthenticated){postCommentHTML+='<div id="sitelife-post-comment-ARTICELID" class="module-comments">';postCommentHTML+='<div class="sans-comments arrow-hued">';postCommentHTML+='<h4 class="call-to-action">Have something important to say? Post your comment.</h4>';postCommentHTML+='<div class="post">';postCommentHTML+='<div class="photo"><p><img src="'+currentUsersAvatar+'" alt="'+currentUsersProperName+'" /></p></div>';postCommentHTML+='<div class="details">';postCommentHTML+='<img src="/images/modules/in-context/post-bubble-top.gif" alt="post bubble top" />';postCommentHTML+='<div class="quote">';ArticleTitle=escapeQuotes(ArticleTitle);postCommentHTML+='<form id="post-comment" action="/" onsubmit="return submitCommentToPluck(\''+assetId+"', '"+document.location.href+"', '"+ArticleTitle+"');\">";postCommentHTML+="<p>";postCommentHTML+='<label for="comment-box" class="none">Type a comment:</label>';postCommentHTML+='<textarea name="comment-box" id="comment-box" class="comment-box" rows="4" cols="80"></textarea>';postCommentHTML+='<label for="post-comment" class="none">Submit comment:</label>';postCommentHTML+='<input type="image" name="post-button" id="post-button" src="/images/modules/in-context/buttons/post-comment.gif" alt="post a comment" class="post-button" />';postCommentHTML+="</p>";postCommentHTML+="</form>";postCommentHTML+="</div>";postCommentHTML+='<img src="/images/modules/in-context/post-bubble-bottom.gif" alt="post bubble bottom" />';postCommentHTML+='<p class="name">'+currentUsersScreenname+"</p>";postCommentHTML+="</div>";postCommentHTML+='<p class="disclaimer">User comments may be used elsewhere on this site. Comments that include profanity, or personal attacks, or antisocial behavior such as "spamming" or "trolling," or other inappropriate comments or material will be removed from the site. We will take steps to block users who violate any of our terms of use. You are fully responsible for the content that you post.</p>';postCommentHTML+='<p class="disclaimer">By posting on our site, you agree to comply with our terms of use.  <a href="http://corporate.discovery.com/utilities/about/visitoragreement.html#social">Please review the terms here.</a></p>';postCommentHTML+="</div>";postCommentHTML+="</div>";postCommentHTML+="</div>"}else{postCommentHTML+='<div id="sitelife-post-comment-'+assetId+'" class="module-comments">';postCommentHTML+='<div class="sans-comments arrow-hued">';postCommentHTML+='<h4 class="call-to-action">Have something important to say? Post your comment.</h4>';postCommentHTML+='<div class="post">';postCommentHTML+='<div class="photo"><p><img src="'+currentUsersAvatar+'" alt="'+currentUsersProperName+'" /></p></div>';postCommentHTML+='<div class="details">';postCommentHTML+='<img src="/images/modules/in-context/post-bubble-top.gif" alt="post bubble top" />';postCommentHTML+='<div class="quote">';postCommentHTML+='<form id="post-comment" action="/">';postCommentHTML+="<p>";postCommentHTML+='<label for="comment-box" class="none">Type a comment:</label>';postCommentHTML+='<textarea name="comment-box" id="comment-box" class="comment-box" rows="4" cols="80" disabled="disabled" readonly="readonly">You must be logged in to post a comment.</textarea>';postCommentHTML+="</p>";postCommentHTML+="</form>";postCommentHTML+='<div class="link-to-dora"><a href="javascript: void(null);" onclick="bounceToDORAUI(\'register\');"><img src="/images/modules/in-context/buttons/become-a-member.gif" alt="become a member" /></a> &#160; <a href="javascript: void(null);" onclick="bounceToDORAUI(\'login\');"><img src="/images/modules/in-context/buttons/log-in.gif" alt="log in" /></a></div>';postCommentHTML+="</div>";postCommentHTML+='<img src="/images/modules/in-context/post-bubble-bottom.gif" alt="post bubble bottom" />';postCommentHTML+='<p class="name hidden">BLANK</p>';postCommentHTML+='<p class="affiliate hidden">BLANK</p>';postCommentHTML+="</div>";postCommentHTML+='<p class="disclaimer">User comments may be used elsewhere on this site. Comments that include profanity, or personal attacks, or antisocial behavior such as "spamming" or "trolling," or other inappropriate comments or material will be removed from the site. We will take steps to block users who violate any of our terms of use. You are fully responsible for the content that you post.</p>';postCommentHTML+='<p class="disclaimer">By posting on our site, you agree to comply with our terms of use.  <a href="http://corporate.discovery.com/utilities/about/visitoragreement.html#social">Please review the terms here.</a></p>';postCommentHTML+="</div>";postCommentHTML+="</div>";postCommentHTML+="</div>"}return postCommentHTML}function writePostedBubbleHTML(comment){var authorUserTier="";switch(comment.Author.UserTier){case"Editor":authorUserTier="Moderator";break;case"Featured":authorUserTier="Guest Contributor";break;case"Staff":authorUserTier="Planet Green Staff";break;case"Trusted":authorUserTier="Featured Member";break;default:authorUserTier="Planet Green Member"}var commentURL=createCommentsURL();var postedBubbleHTML='<dd class="comment">';postedBubbleHTML+='<div class="photo"><p><a href="/accounts/persona.html?member='+comment.Author.UserKey.Key+'"><img src="'+comment.Author.AvatarPhotoUrl+'" alt="'+comment.Author.DisplayName+'" /></a></p></div>';postedBubbleHTML+='<div class="details">';postedBubbleHTML+='<div><img src="/images/modules/in-context/quote-bubble-top.gif" alt="quote bubble top" /></div>';postedBubbleHTML+='<div class="quote">';postedBubbleHTML+="<p>";postedBubbleHTML+='<span class="text">&#8220;'+truncText(comment.CommentBody);+"&#8221;</span><br />";postedBubbleHTML+='<a href="'+commentURL+'">+ READ FULL COMMENT</a><br />';postedBubbleHTML+="</p>";postedBubbleHTML+="</div>";postedBubbleHTML+='<div><img src="/images/modules/in-context/quote-bubble-bottom.gif" alt="quote bubble bottom" /></div>';postedBubbleHTML+='<strong class="name"><a href="/accounts/persona.html?member='+comment.Author.UserKey.Key+'">'+comment.Author.DisplayName+"</a></strong><br />";postedBubbleHTML+='<strong class="affiliate">'+authorUserTier+"</strong><br />";postedBubbleHTML+='<span class="date">'+processDateTime(comment.PostedAtTime)+"</span><br />";postedBubbleHTML+="</div>";postedBubbleHTML+="</dd>";return postedBubbleHTML}function truncText(val){var comLength=95;var index=val.lastIndexOf(" ",comLength);var valLength=val.length;if(val!=null&&valLength>comLength){val=val.substring(0,index)+"..."}return val}function processDateTime(value){var curDate=new Date();var dttm=new Date(value);var epochNow=curDate.getTime();var epochDttm=dttm.getTime();var millisPerHour=60*60*1000;var gmtLocal=curDate.getTimezoneOffset()/60;var hoursToAdd=gmtLocal-4;var hours=((epochNow-epochDttm)/millisPerHour)+hoursToAdd;var hoursPerDay=24;var day=dttm.getDate();var month=dttm.getMonth();var year=dttm.getFullYear();var m_abbr=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");if(hours>hoursPerDay){return(day+" "+m_abbr[month]+" "+year)}else{if(hours>=2){return(Math.floor(hours)+" hours ago")}else{if(hours>=1){return(Math.floor(hours)+" hour ago")}else{if(hours>=0){return(Math.floor(hours*60)+" minutes ago")}else{return(day+" "+m_abbr[month]+" "+year)}}}}}function createCommentsURL(){var str=location.href;var url=str.substring(0,str.lastIndexOf("/"));var page=str.substring(str.lastIndexOf("/"));return(url+"/comments"+page)}if("undefined"!=typeof window.addEventListener){window.addEventListener("load",function(){submitRequest()},false)}else{if("undefined"!=typeof window.attachEvent){window.attachEvent("onload",function(){submitRequest()})}};