function Rating(a,b){this.ratingDiv=document.getElementById(a);this.rating="";this.id=b;this.aAnchors=[];Rating.init=function(c){Rating.numberItems=c};Rating.addSubmitListener=function(c){Rating.submitHandler=c};Rating.prototype.initRating=function(){if(this.ratingDiv==null){return false}var e=this.ratingDiv.childNodes;var d=0;for(var c=0;c<e.length;c++){if(e[c].nodeType==1){this.aAnchors.push(e[c].id);this.attachMouseEvents(e[c].id,d);d++}}};Rating.prototype.setRating=function(d){this.rating=d;if(isNaN(this.rating)){this.rating=0}if(this.rating>Rating.numberItems){this.rating=0}for(var c=0;c<Rating.numberItems;c++){if(c+1<=d){jQuery("#"+this.aAnchors[c]).removeClass("inactive").addClass("active")}else{jQuery("#"+this.aAnchors[c]).removeClass("active").addClass("inactive")}}};Rating.prototype.fillRatings=function(d){for(var c=0;c<Rating.numberItems;c++){if(d>=c){jQuery("#"+this.aAnchors[c]).removeClass("inactive").removeClass("active").addClass("hover")}else{jQuery("#"+this.aAnchors[c]).removeClass("hover").removeClass("active").addClass("inactive")}}};Rating.prototype.resetRatings=function(){var d=this.rating-1;for(var c=0;c<Rating.numberItems;c++){if(d>=0&&c<=d){jQuery("#"+this.aAnchors[c]).removeClass("inactive").removeClass("hover").addClass("active")}else{jQuery("#"+this.aAnchors[c]).removeClass("active").removeClass("hover").addClass("inactive")}}};Rating.prototype.attachMouseEvents=function(e,d){var c=document.getElementById(e);var f=this;c.onclick=function(){Rating.submitHandler.submitRating(d+1,f.id,this);return false};c.onmouseout=function(){f.resetRatings()};c.onmouseover=function(){f.fillRatings(d)}}}function Cookie(c){this.$name=c;var f=document.cookie;if(f==""){return}var g=f.replace(" ","").split(";");var e=null;for(var d=0;d<g.length;d++){g[d]=g[d].replace(/\s/g,"");if(g[d].substring(0,c.length+1)==(c+"=")){e=g[d];break}}if(e==null){return}var h=e.substring(c.length+1);var b=h.split("&");for(var d=0;d<b.length;d++){b[d]=b[d].split(":")}for(var d=0;d<b.length;d++){this[b[d][0]]=decodeURIComponent(b[d][1])}}Cookie.prototype.store=function(a,f,d,e){var c="";for(var g in this){if((g.charAt(0)=="$")||((typeof this[g])=="function")){continue}if(c!=""){c+="&"}c+=g+":"+encodeURIComponent(this[g])}var b=this.$name+"="+c;if(a||a==0){b+="; max-age="+(a*24*60*60)}if(f==undefined){f="/"}if(f){b+="; path="+f}if(d){b+="; domain="+d}if(e){b+="; secure"}document.cookie=b};Cookie.prototype.remove=function(c,a,b){for(var d in this){if(d.charAt(0)!="$"&&typeof this[d]!="function"){delete this[d]}}this.store(0,c,a,b)};Cookie.enabled=function(){if(navigator.cookieEnabled!=undefined){return navigator.cookieEnabled}if(Cookie.enabled.cache!=undefined){return Cookie.enabled.cache}document.cookie="testcookie=test; max-age=10000";var a=document.cookie;if(a.indexOf("testcookie=test")==-1){return Cookie.enabled.cache=false}else{document.cookie="testcookie=test; max-age=0";return Cookie.enabled.cache=true}};if(typeof CN=="undefined"){var CN={}}CN.pluck=CN.pluck||{};function Pluck(e){var g=this;g.callbackHandler=(e||PluckMarkupGenerator);g.serverUrl="";g.commentForm={};g.crLogicHelper={};g.crLookUp={};g.crMetaData={};g.programUrl="";g.artId="";g.pluckBatchSize=10;g.currentPage=1;g.numberPerPage="";g.currentRating=-1;g.isLoggedIn="";g.loginUrl="";g.pluckActive=true;g.requestBatch="";g.gatewayHandler;g.callbackHandler.parentHandler=g;function b(i){return document.getElementById(i)||false}function a(j,i){if(!i){return g.crLogicHelper[j]?true:false}return(g.crLogicHelper[j]&&g.crLogicHelper[j].indexOf(i)===-1)?false:true}function d(k){if(typeof k==="string"){k=k.split(",")}var m=0,j=k.length,l=[];for(;m<j;m++){if(k[m]!==""){l.push(k[m] instanceof Category?k[m]:new Category(k[m]))}}return l}function f(i){return i.charAt(0).toUpperCase()+i.substr(1)}function c(k,j,i){if(!i){return(g.crMetaData[k]&&g.crMetaData[k][j]?g.crMetaData[k][j]:false)||(b("commentPage"+f(j)+"_"+k)?b("commentPage"+f(j)+"_"+k).value:"")}g.crMetaData[k][j]=i}function h(j,o,m){var k=CN.utils.trim(jQuery("#commentText_"+j).val()),j=String(j),r=new ArticleKey(j),n=CN.url.section(),s=c(j,"type"),q=c(j,"kw"),i=c(j,"title"),p=location.protocol+"//"+location.host+(s==="blog"||c(j,"url")?location.pathname:"/services/lookup/"+j.substr(j.indexOf("_")+1)),l=0;if(!k){alert("You must enter comment text.");return false}if(m==="review"&&a(j,"R")){l=g.callbackHandler.articleRating;if(g.currentRating!=l&&g.currentRating!=-1){l=g.currentRating}}if(m==="comment"){jQuery(window).trigger("CN.customEvents.pluckCommentSubmitted",[i,p,s+"/"+n,k]);CN.debug.info("firing CN.customEvents.pluckCommentSubmitted event")}if(CN.stats&&CN.stats.omniture){CN.stats.omniture.trackAction("comment",g.commentForm[j][0])}g.currentPage=1;g.requestBatch=new RequestBatch();g.requestBatch.AddToRequest(new UpdateArticleAction(r,p,i,new Section(n),d(s+","+q)));g.requestBatch.AddToRequest((m==="comment"?new CommentAction(r,p,i,k):new ReviewAction(r,p,i,i,l,k,"","")));g.addToRequest(j,m).submitRequest();jQuery("#commentText_"+j).val("");return false}Pluck.prototype.init=function(i,j,k){g.numberPerPage=j;g.loginUrl=k;g.isLoggedIn=g.LoggedIn();g.serverUrl=i};Pluck.prototype.LoggedIn=function(){return CN.user.isLoggedIn()};Pluck.prototype.addGatewayListener=function(i){g.gatewayHandler=i};Pluck.prototype.initCommentForm=function(i,m,n,j){var k="comment",j=j||k;try{g.requestBatch=new RequestBatch()}catch(l){g.pluckActive=false;CN.debug.user(l)}g.commentForm[m]=jQuery("#"+i);if(g.commentForm[m].length&&g.pluckActive){jQuery(g.commentForm[m]).attr({name:i}).unbind("submit");jQuery(g.commentForm[m]).attr({name:i}).unbind("submit").bind("submit",{type:j},function(o){return(o.data.type==="comment")?g.submitComment(m):g.submitReview(m)});jQuery("#frmPostBtn_"+m).bind("click",function(){if(!MAGNET.user.isLoggedIn()){return false}});jQuery("#commentText_"+m).bind("blur",function(){if(!CN.user.isLoggedIn()){this.value=""}}).one("focus",function(){CN.stats.omniture.trackActionEvar("commentFocus",this,"eVar39","comment on focus")}).bind("focus",function(){if(!CN.user.isLoggedIn()){g.gatewayHandler.loginHandler("comment",this);jQuery(this).blur()}})}else{jQuery("#"+n).hide()}};Pluck.prototype.initPrivateCommentForm=function(j,i,m,l){if(document.getElementById(j)){this.privateCommentForm=document.getElementById(j);this.programUrl=l;if(this.privateCommentForm==null){return false}if(this.pluckActive){var k=this;this.privateCommentForm.onsubmit=function(){return k.submitPrivateComment(i)}}else{document.getElementById(m).style.display="none"}}};Pluck.prototype.doMultArticleRequest=function(l){for(var k=0,j=l.length;k<j;k++){Pluck.prototype.doArticleRequest(l[k])}};Pluck.prototype.doArticleRequest=function(i){if(g.pluckActive){g.requestBatch=new RequestBatch();if(a(i,"R")||a(i,"A")){g.addToRequest(i,"article").submitRequest();if(a(i,"R")){g.callbackHandler.initRatings(i,g.isLoggedIn)}}if(a(i,"V")){g.addToRequest(i,"review").submitRequest()}if(a(i,"C")){g.addToRequest(i,"comment").submitRequest()}}else{g.callbackHandler.suppressPluck(i)}};Pluck.prototype.updateMultReviews=function(m,l){var n,k=0,i;if(g.pluckActive){g.requestBatch=new RequestBatch();for(;k<aIdslength;k++){g.artId=n=m[k];g.addToRequest(n,"review");if(k%10===0&&k>0){g.submitRequest()}if(g.commentForm[n]){g.commentForm[n].onsubmit=function(){return g.submitComment(n)}}}g.submitRequest();g.callbackHandler.setViewType(l)}else{g.callbackHandler.suppressPluck(m)}};Pluck.prototype.updateReviews=function(j,i){Pluck.prototype.updateMultReviews([j],i)};Pluck.prototype.getNextPage=function(i){g.currentPage=g.currentPage+1;g.doArticleRequest(i)};Pluck.prototype.getPrevPage=function(i){g.currentPage=(g.currentPage>0?g.currentPage-1:0);g.doArticleRequest(i)};Pluck.prototype.addToRequest=function(m,i,j){var l=new ArticleKey(m),k="TimeStampDescending",j=j||g.requestBatch;switch(i){case"article":j.AddToRequest(l);break;case"comment":j.AddToRequest(new CommentPage(l,g.numberPerPage,g.currentPage,k));break;case"review":j.AddToRequest(new ReviewPage(l,g.numberPerPage,g.currentPage,k));break}return g};Pluck.prototype.submitRequest=function(i){(i||g.requestBatch).BeginRequest(g.serverUrl,g.callbackHandler.renderReviewPage);if(!i){g.requestBatch=new RequestBatch()}return g};Pluck.prototype.submitRating=function(k,j,l){var j=j+"",p=new ArticleKey(j),m=CN.url.section(),q=c(j,"type"),o=c(j,"kw"),i=c(j,"title"),n=location.protocol+"//"+location.host+(q==="blog"||c(j,"url")?location.pathname:"/services/lookup/"+j.substr(j.indexOf("_")+1));if(g.isLoggedIn){if(typeof CN!=="undefined"&&CN.stats&&CN.stats.omniture){CN.stats.omniture.trackAction("rating",l)}g.currentRating=k;g.requestBatch=new RequestBatch();g.requestBatch.AddToRequest(new UpdateArticleAction(p,n,i,new Section(m),d(q+","+o)));g.requestBatch.AddToRequest(new RateAction(p,k));g.addToRequest(j,"article").submitRequest()}else{g.loginHandler(l,"rating")}};Pluck.prototype.loginHandler=function(j,i){if(g.gatewayHandler){g.gatewayHandler.loginHandler(i,j)}};Pluck.prototype.submitReview=function(j,i){return h(j,i,"review")};Pluck.prototype.submitComment=function(j,i){return h(j,i,"comment")};Pluck.prototype.metaDataHelper=function(k,j,i){if(!(k&&j)){return{}}return c(k,j,i)};Pluck.prototype.ReviewPageHandler=function(i){g.callbackHandler.drawReview(i)};Pluck.prototype.submitRecommendation=function(k,j,i){i=i||"review";if(!g.isLoggedIn){g.loginHandler(j,"recommendation");return false}g.requestBatch=new RequestBatch();g.requestBatch.AddToRequest(new RecommendAction((i==="comment"?new CommentKey(k):new ReviewKey(k))));g.callbackHandler.setLastRecommendation(k);g.requestBatch.BeginRequest(g.serverUrl,g.callbackHandler.updateRecommendation)};Pluck.prototype.submitReportAbuse=function(l,j,k,i){i=i||"review";g.requestBatch=new RequestBatch();g.requestBatch.AddToRequest(new ReportAbuseAction((i==="comment"?new CommentKey(l):new ReviewKey(l)),j,k));g.requestBatch.BeginRequest(g.serverUrl,g.callbackHandler.updateAbuse)}}function PluckMarkupGenerator(){PluckMarkupGenerator.ratings="";PluckMarkupGenerator.currentView="";PluckMarkupGenerator.abuseThreshold=3;PluckMarkupGenerator.numberOfComments=0;PluckMarkupGenerator.userId="";PluckMarkupGenerator.parentHandler="";PluckMarkupGenerator.setViewType=function(type){PluckMarkupGenerator.currentView=type};PluckMarkupGenerator.initRatings=function(aIds,loggedIn){PluckMarkupGenerator.articleRating=0;if(typeof aIds!="object"){var temp=aIds;aIds=new Array();aIds.push(temp)}PluckMarkupGenerator.aRatings=PluckMarkupGenerator.aRatings||[];for(var j=0;j<aIds.length;j++){PluckMarkupGenerator.aRatings[aIds[j]]=new Rating("ratingGroup_"+aIds[j],aIds[j]);PluckMarkupGenerator.aRatings[aIds[j]].initRating()}};PluckMarkupGenerator.suppressPluck=function(aIds){if(typeof aIds!="object"){var temp=aIds;aIds=new Array();aIds.push(temp)}try{for(j=0;j<aIds.length;j++){document.getElementById("totalComments_"+aIds[j]).style.display="none"}}catch(e){}try{for(var j=0;j<aIds.length;j++){document.getElementById("rating_"+aIds[j]).style.display="none"}}catch(e){}};PluckMarkupGenerator.drawArticle=function(Article){var artKey=Article.ArticleKey.Key;if(PluckMarkupGenerator.parentHandler.crLogicHelper[artKey].indexOf("R")!="-1"){var rating=Math.round(Article.Ratings.AverageRating*10)/10;if(rating>=0){if(document.getElementById("ratingAverageTxtshort_"+artKey)){document.getElementById("ratingAverageTxtshort_"+artKey).innerHTML="<span>(Avg "+rating+")</span>"}if(document.getElementById("ratingAverageTxt_"+artKey)){document.getElementById("ratingAverageTxt_"+artKey).innerHTML="Average rating ";if(rating==1){rating=rating+' <span class="startxt">star</span>'}else{rating=rating+' <span class="startxt">stars</span>'}document.getElementById("ratingAverage_"+artKey).innerHTML=rating}}PluckMarkupGenerator.articleRating=rating;if(Article.Ratings.CurrentUserRating!=null){PluckMarkupGenerator.articleRating=Article.Ratings.CurrentUserRating;PluckMarkupGenerator.aRatings[artKey].setRating(Article.Ratings.CurrentUserRating)}else{PluckMarkupGenerator.aRatings[artKey].setRating(rating)}}};PluckMarkupGenerator.drawComments=function(commentPage){PluckMarkupGenerator.aData=new Array();PluckMarkupGenerator.aLookup=new Array();PluckMarkupGenerator.numberOfComments=0;if(PluckMarkupGenerator.parentHandler.crLogicHelper[commentPage.ArticleKey.Key].indexOf("C")!="-1"){if(commentPage.NumberOfComments!=null&&document.getElementById("commentAnchor_"+commentPage.ArticleKey.Key)){var insertPoint=document.getElementById("commentAnchor_"+commentPage.ArticleKey.Key);insertPoint.innerHTML="";for(var i=0;i<commentPage.Comments.length;i++){var comment=commentPage.Comments[i];if(PluckMarkupGenerator.isUnderAbuseCount(comment)){PluckMarkupGenerator.aLookup[comment.CommentKey.Key]=i;PluckMarkupGenerator.aData[i]=comment;insertPoint.appendChild(PluckMarkupGenerator.getCommentDiv(comment,i,commentPage.ArticleKey.Key));PluckMarkupGenerator.numberOfComments++}}insertPoint.appendChild(PluckMarkupGenerator.getAbuseDiv(commentPage.ArticleKey.Key));if(commentPage.OnPage>1){var imgLink=PluckMarkupGenerator.createButton("prev_ten_ "+commentPage.ArticleKey.Key,"/css/i/pluck/prev_ten.gif",commentPage.ArticleKey.Key);imgLink.onclick=function(){pluckHandler.getPrevPage(commentPage.ArticleKey.Key);return false};insertPoint.appendChild(imgLink)}if(commentPage.NumberOfComments>(commentPage.NumberPerPage*commentPage.OnPage)){var imgLink=PluckMarkupGenerator.createButton("next_ten_"+commentPage.ArticleKey.Key,"/css/i/pluck/next_ten.gif",commentPage.ArticleKey.Key);imgLink.onclick=function(){pluckHandler.getNextPage(commentPage.ArticleKey.Key);return false};if(commentPage.OnPage>1){imgLink.className="moreLink"}insertPoint.appendChild(imgLink)}}if(PluckMarkupGenerator.parentHandler.crLogicHelper[commentPage.ArticleKey.Key].indexOf("S")!="-1"){var strComments='<a href="#" onclick="return PluckMarkupGenerator.toggleComments(\'comments_'+commentPage.ArticleKey.Key+"')\">Comments <span>("+commentPage.NumberOfComments+")</span></a>"}else{var strComments="Comments <span>("+commentPage.NumberOfComments+")</span>"}if(document.getElementById("totalCommentsshort_"+commentPage.ArticleKey.Key)){document.getElementById("totalCommentsshort_"+commentPage.ArticleKey.Key).innerHTML=strComments;document.getElementById("totalCommentsshort_"+commentPage.ArticleKey.Key).style.display=""}if(document.getElementById("totalComments_"+commentPage.ArticleKey.Key)){var strComments="<span>"+commentPage.NumberOfComments+" comments</span>";document.getElementById("totalComments_"+commentPage.ArticleKey.Key).innerHTML=strComments;document.getElementById("totalComments_"+commentPage.ArticleKey.Key).style.display=""}}};PluckMarkupGenerator.toggleComments=function(cmtId,caller){jQuery("div#"+cmtId).slideToggle("fast");return false};PluckMarkupGenerator.isUnderAbuseCount=function(comment){if(comment.Author.IsBlocked=="False"&&(parseInt(comment.AbuseReportCount)<PluckMarkupGenerator.abuseThreshold)){return true}else{if(comment.Author.IsBlocked=="True"&&(comment.Author.UserKey.Key==PluckMarkupGenerator.userId)&&(parseInt(comment.AbuseReportCount)<PluckMarkupGenerator.abuseThreshold)){return true}else{return false}}};PluckMarkupGenerator.getCommentDiv=function(comment,index,artId){var commentRating="";if(comment.CommentRating>0){commentRating='<div class="commented">';for(var i=0;i<comment.CommentRating;i++){commentRating+='<img class="commentRating" src="/css/i/pluck/star_b.gif" alt="" />'}commentRating+="</div>"}var commentDiv=document.createElement("div");commentDiv.id="commentContainer_"+artId+"_"+index;commentDiv.className="entry";if(PluckMarkupGenerator.currentView=="privatecomments"){commentDiv.className+=" private"}var authorName="";if(typeof(comment.Author)!="undefined"){authorName=" "+comment.Author.DisplayName}commentDiv.innerHTML="<dl><dd>"+comment.CommentBody+'</dd><dd class="dated">Posted at '+comment.PostedAtTime.toLowerCase()+' <span class="author">by '+authorName+'</span></dd><dd class="report">'+PluckMarkupGenerator.getAbuseHTML(comment,index,artId)+"</dd></dl>";return commentDiv};PluckMarkupGenerator.getAbuseDiv=function(artId){var abuseDiv=document.createElement("div");abuseDiv.id="abuseForm_"+artId;abuseDiv.className="aform";abuseDiv.style.display="none";abuseDiv.innerHTML='<form id="reportAbuseForm_'+artId+'"><input type="hidden" id="ReportAbuseKey_'+artId+'" value="" /><input type="hidden" id="ReportAbuseReason_'+artId+'" value="Report Abuse on Wmag"/><div class="row"><a href="#" class="closebtn" onclick="return PluckMarkupGenerator.hideAbuseForm(\''+artId+'\')">X</a></div><div class="row"><label>Comment</label><span class="formw"><textarea id="ReportAbuseCommentText_'+artId+'" cols=16 rows=4></textarea></span></div><input type="image" src="/css/i/pluck/report_btn.gif" value="Report" onclick="return PluckMarkupGenerator.errCheckAbuseForm(document.getElementById(\'ReportAbuseKey_'+artId+"').value,document.getElementById('ReportAbuseReason_"+artId+"').value,document.getElementById('ReportAbuseCommentText_"+artId+"').value,'"+artId+'\')" value="Report" /></form>';return abuseDiv};PluckMarkupGenerator.getAbuseHTML=function(comment,id,artId){var rKey=comment.CommentKey.Key;var fCall;if(PluckMarkupGenerator.parentHandler.LoggedIn()){fCall="PluckMarkupGenerator.showAbuseForm('"+id+"','"+rKey+"','"+artId+"'); return false    "}else{fCall="PluckMarkupGenerator.parentHandler.gatewayHandler.loginHandler('abuse', document.getElementById('report_"+artId+"_"+id+"'));return false;"}var html='<span id="report_'+artId+"_"+id+'"><a class="reportlink" href="#" onclick="'+fCall+'">Report abuse</a></span>';return html};PluckMarkupGenerator.getRecommendationHTML=function(comment,id){if(comment.CurrentUserHasRecommended=="False"){var html='<span id="commentRecommendation_'+id+'" class="commend">('+comment.NumberOfRecommendations+") ";html+='<a href="#" onclick="return pluckHandler.submitRecommendation(\''+comment.CommentKey.Key+"', this)\">recommend this comment</a></span>"}else{var html='<span id="commentRecommendation_'+id+'" class="commended">('+comment.NumberOfRecommendations+") ";html+="recommended</span>"}return html};PluckMarkupGenerator.setLastRecommendation=function(commentKey){PluckMarkupGenerator.lastItem=commentKey};PluckMarkupGenerator.updateRecommendation=function(responseBatch){if(responseBatch.Messages[0].Message=="ok"){var index=PluckMarkupGenerator.aLookup[PluckMarkupGenerator.lastItem];divId="commentRecommendation_"+index;var comment=PluckMarkupGenerator.aData[index];var updatedCount=parseInt(comment.NumberOfRecommendations)+1;var html="("+updatedCount+") recommended</span>";document.getElementById(divId).innerHTML=html;document.getElementById(divId).className="commended"}};PluckMarkupGenerator.setComment=function(comment){PluckMarkupGenerator.lastComment=comment};PluckMarkupGenerator.showAbuseForm=function(id,key,artId){var cmd=eval("document.getElementById('reportAbuseForm_"+artId+"').ReportAbuseKey_"+artId);cmd.value=key;var newTop=document.getElementById("commentContainer_"+artId+"_"+id).offsetTop+document.getElementById("commentContainer_"+artId+"_"+id).offsetHeight+document.getElementById("abuseForm_"+artId).offsetHeight;document.getElementById("abuseForm_"+artId).style.top=newTop+"px";jQuery("div#abuseForm_"+artId).show("fast");return false};PluckMarkupGenerator.hideAbuseForm=function(artId){jQuery("div#abuseForm_"+artId).hide("fast");jQuery("div#abuseForm_"+artId+" :input").val("");document.getElementById("ReportAbuseReason_"+artId).selectedIndex=0;return false};PluckMarkupGenerator.errCheckAbuseForm=function(key,reason,desc,artId){pluckHandler.submitReportAbuse(key,reason,desc);PluckMarkupGenerator.hideAbuseForm(artId);return false};PluckMarkupGenerator.drawNotes=function(){var numPerPage=10;var notes=PluckMarkupGenerator.aNotes;if(PluckMarkupGenerator.currentNotesPage<=0){PluckMarkupGenerator.currentNotesPage=1}document.getElementById("totalComments").style.display="none";insertPoint=document.getElementById("commentAnchor");insertPoint.innerHTML="";var startPoint=numPerPage*(PluckMarkupGenerator.currentNotesPage-1);var stopPoint=(numPerPage*PluckMarkupGenerator.currentNotesPage)-1;if(stopPoint>=notes.length){stopPoint=notes.length-1}for(var i=startPoint;i<=stopPoint;i++){var comment=new Object();comment.CommentBody=notes[i].note;var displayDate=new Date();displayDate.setTime(Date.parse(notes[i].creationDate));var time=PluckMarkupGenerator.formatTime(displayDate);comment.PostedAtTime=displayDate.getMonth()+1+"/"+displayDate.getDate()+"/"+displayDate.getFullYear()+" "+time;insertPoint.appendChild(PluckMarkupGenerator.getCommentDiv(comment,i));PluckMarkupGenerator.aData[i]=comment}if(PluckMarkupGenerator.currentNotesPage>1){var imgLink=PluckMarkupGenerator.createButton("prev_ten","/css/tipsy/i/prev_ten.gif");imgLink.onclick=function(){PluckMarkupGenerator.currentNotesPage--;PluckMarkupGenerator.drawNotes();return false};insertPoint.appendChild(imgLink)}if(PluckMarkupGenerator.aNotes.length>(numPerPage*PluckMarkupGenerator.currentNotesPage)){var imgLink=PluckMarkupGenerator.createButton("next_ten","/css/tipsy/i/next_ten.gif");imgLink.onclick=function(){PluckMarkupGenerator.currentNotesPage++;PluckMarkupGenerator.drawNotes();return false};insertPoint.appendChild(imgLink)}};PluckMarkupGenerator.createButton=function(imgId,imgPath,aId){var imgLink=document.createElement("a");imgLink.href="#commentAnchor_"+aId;var img=document.createElement("img");img.id=imgId;img.className="pageButton";img.src=imgPath;imgLink.appendChild(img);return imgLink};PluckMarkupGenerator.formatTime=function(timeObj){var hours=timeObj.getHours();var minutes=timeObj.getMinutes();var seconds=timeObj.getSeconds();var timeValue=""+((hours>12)?hours-12:hours);if(timeValue=="0"){timeValue=12}timeValue+=((minutes<10)?":0":":")+minutes;timeValue+=((seconds<10)?":0":":")+seconds;timeValue+=(hours>=12)?" PM":" AM";return timeValue};PluckMarkupGenerator.updateAbuse=function(responseBatch){if(responseBatch.Messages[0].Message=="ok"){}};PluckMarkupGenerator.renderReviewPage=function(responseBatch){for(var i=0;i<responseBatch.Responses.length;i++){var response=responseBatch.Responses[i];if(response.Article!=null&&PluckMarkupGenerator.parentHandler.crLogicHelper[response.Article.ArticleKey.Key].indexOf("R")!="-1"){PluckMarkupGenerator.drawArticle(response.Article)}else{if(response.CommentPage!=null&&PluckMarkupGenerator.parentHandler.crLogicHelper[response.CommentPage.ArticleKey.Key].indexOf("C")!="-1"){PluckMarkupGenerator.drawComments(response.CommentPage)}else{if(response.User!=null){PluckMarkupGenerator.userId=response.User.UserKey.Key}}}}}}PluckMarkupGenerator.renderNotes=function(b){PluckMarkupGenerator.aNotes=b;PluckMarkupGenerator.currentNotesPage=1;if(b.length==1){var a=b.length+" comment"}else{var a=b.length+" comments"}document.getElementById("totalComments").innerHTML=a;PluckMarkupGenerator.drawNotes()};function RegisteredGateway(b,e,c){var a=this,d='<a href="'+b+'" class="lnkLogin reglayer-login" title="Login">Login</a> or <a href="'+e+'" class="lnkRegister reglayer-register" title="Register">register</a>';this.boxWidth="";this.aLoginMessages={log:d+" to log this tip.",rating:d+" to post your rating.",comment:d+" to post your comment.",favorites:d+" now to add this tip to your favorites.",recommendation:d+" to recommend this tip.",abuse:d+" to report this comment.","default":d+" to use this program."};this.signinUrl=b;this.gatewayUrl=e;RegisteredGateway.prototype.init=function(){a.createRegisterDiv()};RegisteredGateway.prototype.createRegisterDiv=function(){if(!jQuery("#reglayer").length){jQuery('<div id="reglayer"/>').addClass("regblurb").append(jQuery('<a href="#"/>').addClass("closebtn").html("&times;").bind("click",function(){jQuery(this).parent().hide();return false}),jQuery('<p id="regtxt"/>')).appendTo("body");jQuery(".closebtn").trigger("click")}CN.debug.info("firing CN.customEvents.pluckRegLayer event");jQuery(window).trigger("CN.customEvents.pluckRegLayer")};RegisteredGateway.prototype.getGatewayUrl=function(){return this.gatewayUrl};RegisteredGateway.prototype.setLoginText=function(f){return jQuery("#regtxt").html(f).length>0?true:false};RegisteredGateway.prototype.loginHandler=function(f,k){var k=jQuery(k),g=jQuery("#reglayer");var j=jQuery(window);jQuery(window).bind("resize",{layer:g,target:k},this.onResize);var i=k.offset().top,h=k.offset().left+(k.width()/2)-(g.width()/2);if(CN.site.mobilecompatible){if((CN.mobile.detectIPad()||CN.mobile.detectIPhone())){i=j.scrollTop()+(j.height()/4);h=j.width()/2-(jQuery("div.regblurb").width()*2)}}g.css({top:i,left:h}).find("#regtxt").html(this.aLoginMessages[f]).end().show();return false};RegisteredGateway.prototype.onResize=function(g){var f=jQuery(window);g.data.layer.css({top:f.scrollTop()+(f.height()/4),left:f.width()/2-(jQuery("div.regblurb").width()*2)})}}jQuery(window).bind("CN.customEvents.pluckRegLayerHide",function(){jQuery("#reglayer").hide()});
