Type.registerNamespace('SpottedScript.Controls.CommentsDisplay');
SpottedScript.Controls.CommentsDisplay.CommentStub=function(){}
SpottedScript.Controls.CommentsDisplay.CommentStub.prototype={k:0,usrUrl:null,usrK:0,usrRollover:null,usrPicSrc:null,usrName:null,isNew:false,html:null,script:null,lolHtml:null,haveAlreadyLold:false,friendlyTimeNoCaps:null,editLinkVisible:false,editedHtml:null,deleteLinkVisible:false,deleteLinkOnClickConfirmText:null,threadK:0}
SpottedScript.Controls.CommentsDisplay.CommentResult=function(){}
SpottedScript.Controls.CommentsDisplay.CommentResult.prototype={initialComment:null,comments:null,lastPage:0,currentPage:0,firstUnreadPage:0,viewComments:0,totalComments:0}
SpottedScript.Controls.CommentsDisplay.Controller=function(view){this.$0=view;this.$1=new SpottedScript.Controls.CommentsDisplay._ThreadCommentsProvider(this.get_$7());this.$1.$1E=view.get_uiCommentsAnchor().getAttribute('name');this.$1.$14=Function.createDelegate(this,this.$C);this.$8();this.$3=document.createElement('center');view.get_uiCommentsPanelClientSide().appendChild(this.$3);this.$4=document.createElement('div');this.$4.style.textAlign='right';view.get_uiCommentsPanelClientSide().appendChild(this.$4);this.$5=document.createElement('div');view.get_uiCommentsPanelClientSide().appendChild(this.$5);this.$6=document.createElement('div');this.$6.style.textAlign='right';view.get_uiCommentsPanelClientSide().appendChild(this.$6);}
SpottedScript.Controls.CommentsDisplay.Controller.$11=function($p0){for(var $0=0;$0<$p0.childNodes.length;$0++){$p0.removeChild($p0.childNodes[$0]);}$p0.innerHTML='';}
SpottedScript.Controls.CommentsDisplay.Controller.prototype={$0:null,$1:null,get_$2:function(){return this.$0.get_uiClientID().value+'_controls_';},$3:null,$4:null,$5:null,$6:null,get_$7:function(){return Number.parseInvariant(this.$0.get_uiCommentsPerPage().value);},$8:function(){if(this.$0.get_uiInitialCommentDataList()){this.$0.get_uiInitialCommentDataList().style.display='none';}this.$0.get_uiCommentsPanelServerSide().style.display='none';this.$0.get_uiCommentsPanelClientSide().style.display='';},setCommentsCount:function(commentsCount){if(!commentsCount){this.$3.innerHTML='<p>No comments</p>';this.$0.get_uiInitialCommentPanel().style.display='none';this.$0.get_uiCommentsPanel().style.display='none';}else{this.$3.innerHTML=(commentsCount===1)?'<p>1 comment loading...</p>':'<p>'+commentsCount+' comments loading...</p>';this.$0.get_uiCommentsPanelClientSide().style.display='';this.$0.get_uiCommentsPanel().style.display='';}this.$9(false);this.$3.style.display='';},$9:function($p0){var $0=($p0)?'':'none';var $1=($p0&&this.$1.get_$B()>1)?'':'none';this.$4.style.display=$1;this.$5.style.display=$0;this.$6.style.display=$1;if($p0){this.$0.get_uiCommentsPanel().style.display='';}},$A:function(){this.$3.style.display='none';},showComments:function(threadK,pageNumber){this.$1.set_$2(threadK);this.$1.set_$4(pageNumber);this.$1.$18();},$B:null,$C:function($p0,$p1){if(this.$1.get_$13()>0){this.$D();}else{this.$0.get_uiCommentsPanel().style.display='none';}if(this.$B){this.$B(this,$p1);}},$D:function(){this.$12();this.$10();this.$0.get_uiCommentsPanelClientSide().style.display='';this.$E();this.$A();},$E:function(){SpottedScript.Controls.CommentsDisplay.Controller.$11(this.$5);this.$9(true);var $0=this.$1.get_$8();for(var $1=0;$1<$0.length;$1++){this.$F($0[$1]);}for(var $2=0;$2<$0.length;$2++){try{eval($0[$2].script);}catch($3){}}},$F:function($p0){this.$5.appendChild(this.$18($p0));this.$5.appendChild(this.$19($p0));},$10:function(){if(this.$1.get_$B()===1){this.$4.style.display='none';this.$6.style.display='none';return;}this.$4.style.display='';SpottedScript.Controls.CommentsDisplay.Controller.$11(this.$4);this.$4.appendChild(this.$1.$23());this.$4.appendChild(this.$1.$24());this.$4.style.display='';SpottedScript.Controls.CommentsDisplay.Controller.$11(this.$6);this.$6.appendChild(this.$1.$24());this.$6.appendChild(this.$1.$23());},$12:function(){if(this.$1.get_$6()&&this.$1.get_$4()>1){this.$0.get_uiInitialCommentPanel().style.display='';this.$0.get_uiInitialComment().style.display='';for(var $0=0;$0<this.$0.get_uiInitialComment().childNodes.length;$0++){this.$0.get_uiInitialComment().removeChild(this.$0.get_uiInitialComment().childNodes[$0]);}this.$0.get_uiInitialComment().appendChild(this.$19(this.$1.get_$6()));this.$13('Replies');}else{this.$0.get_uiInitialCommentPanel().style.display='none';this.$13('Comments');}},$13:function($p0){this.$0.get_commentsSubjectH1().childNodes[0].innerHTML=$p0;},$14:function($p0,$p1){document.getElementById(this.$16($p0)).style.display='none';(document.getElementById(this.$17($p0))).innerHTML=$p1;},$15:function($p0){return this.get_$2()+'C'+$p0;},$16:function($p0){return this.get_$2()+'L'+$p0;},$17:function($p0){return this.get_$2()+'H'+$p0;},$18:function($p0){var $0=document.createElement('a');$0.id='Anchor-CommentK-'+$p0.k;return $0;},$19:function($p0){var $0=document.createElement('div');$0.className='CommentOuter ClearAfter';$0.appendChild(this.$1A($p0));$0.appendChild(this.$1B($p0));return $0;},$1A:function($p0){var $0=document.createElement('div');$0.className='CommentLeft';var $1=document.createElement('a');$1.href=$p0.usrUrl;this.$1C($1,$p0.usrRollover,'htm();');var $2=document.createElement('img');$2.src=$p0.usrPicSrc;$2.style.width='100px';$2.style.height='100px';$2.style.marginBottom='2px';$2.style.marginTop='0px';$2.className='BorderBlack All Block';$1.appendChild($2);$0.appendChild($1);var $3=document.createElement('a');$3.href=$p0.usrUrl;$3.innerHTML=$p0.usrName;$0.appendChild($3);return $0;},$1B:function($p0){var $0=document.createElement('div');$0.className='CommentBody';$0.innerHTML=(($p0.isNew)?'<a name=\"Unread\"></a><span class=\"Unread\">NEW</span> ':'')+$p0.html;var $1=document.createElement('div');$1.className='CommentAdmin';var $2=document.createElement('small');var $3=document.createElement('span');$3.className='CleanLinks';$3.innerHTML=$p0.lolHtml;$3.id=this.$17($p0.k);$2.appendChild($3);if(!$p0.haveAlreadyLold&&Boolean.parse(this.$0.get_uiUsrIsLoggedIn().value)){$2.appendChild(document.createTextNode(' '));var $7=document.createElement('div');var $8=document.createElement('a');$8.href='#';$8.innerHTML='This made me laugh!';$8.setAttribute(SpottedScript.Controls.CommentsDisplay._Properties.$1,$p0.k);$addHandler($8,'click',Function.createDelegate(this,this.$1F));$7.appendChild($8);$7.id=this.$16($p0.k);$2.appendChild($7);}$2.appendChild(document.createTextNode(' '));var $4=document.createElement('a');$4.href='#PostComment';$4.innerHTML='Reply';$2.appendChild($4);$2.appendChild(document.createTextNode(' '));var $5=document.createElement('a');$5.innerHTML='Quote';$5.href='#';$addHandler($5,'mousedown',Function.createDelegate(this,this.$21));$addHandler($5,'click',Function.createDelegate(this,this.$22));$5.setAttribute(SpottedScript.Controls.CommentsDisplay._Properties.$2,$p0.usrK);$2.appendChild($5);if($p0.editLinkVisible){$2.appendChild(document.createTextNode(' '));var $9=document.createElement('a');$9.innerHTML='Edit';$9.href='/pages/commentedit/k-'+$p0.k;$2.appendChild($9);}if($p0.deleteLinkVisible){$2.appendChild(document.createTextNode(' '));var $A=document.createElement('a');$A.innerHTML='Delete';$A.href='#';$addHandler($A,'click',Function.createDelegate(this,this.$23));$A.setAttribute(SpottedScript.Controls.CommentsDisplay._Properties.$0,$p0.deleteLinkOnClickConfirmText);$A.setAttribute(SpottedScript.Controls.CommentsDisplay._Properties.$1,$p0.k);$A.style.paddingLeft='4px';$2.appendChild($A);}$2.appendChild(document.createElement('br'));var $6=document.createElement('span');this.$1C($6,'stt(\''+$p0.k+'\');','htm();');$6.innerHTML='Posted '+$p0.friendlyTimeNoCaps;$2.appendChild($6);if($p0.editedHtml&&$p0.editedHtml.length>0){var $B=document.createElement('span');$B.innerHTML=$p0.editedHtml;$2.appendChild($B);}$1.appendChild($2);$0.appendChild($1);return $0;},$1C:function($p0,$p1,$p2){$p0.setAttribute('mouseover',$p1);$addHandler($p0,'mouseover',Function.createDelegate(this,this.$1D));$p0.setAttribute('mouseout',$p2);$addHandler($p0,'mouseout',Function.createDelegate(this,this.$1E));},$1D:function($p0){eval($p0.target.getAttribute('mouseover'));},$1E:function($p0){eval('htm();');},$1F:function($p0){$p0.preventDefault();var $0=$p0.target.getAttribute(SpottedScript.Controls.CommentsDisplay._Properties.$1);Spotted.WebServices.Controls.CommentsDisplay.Service.lolAtComment($0,Function.createDelegate(this,this.$20),Function.createDelegate(null,Utils.Trace.webServiceFailure),$0,-1);},$20:function($p0,$p1,$p2){this.$14($p1,$p0);},$21:function($p0){$p0.preventDefault();var $0=$p0.target.getAttribute(SpottedScript.Controls.CommentsDisplay._Properties.$2);eval('QuoteNow('+$0.toString()+');');},$22:function($p0){$p0.preventDefault();eval('FocusNow();');},$23:function($p0){$p0.preventDefault();SpottedScript.Misc.showWaitingCursor();if(confirm($p0.target.getAttribute(SpottedScript.Controls.CommentsDisplay._Properties.$0))){var $0=$p0.target.getAttribute(SpottedScript.Controls.CommentsDisplay._Properties.$1);Spotted.WebServices.Controls.CommentsDisplay.Service.deleteComment($0,Function.createDelegate(this,this.$24),Function.createDelegate(this,this.$25),$0,-1);}},onThreadDeleted:null,$24:function($p0,$p1,$p2){SpottedScript.Misc.hideWaitingCursor();if($p0){if(this.$1.get_$13()===1){if(this.onThreadDeleted){this.onThreadDeleted(this,new SpottedScript.IntEventArgs(this.$1.get_$2()));}this.$1.set_$2(0);this.$0.get_uiCommentsPanel().style.display='none';}this.$1.$32();this.$1.$31();}},$25:function($p0,$p1,$p2){SpottedScript.Misc.hideWaitingCursor();}}
SpottedScript.Controls.CommentsDisplay._Properties=function(){}
SpottedScript.Controls.CommentsDisplay._ThreadCommentsProvider=function(commentsPerPage){this.$0=commentsPerPage;this.$7=[];this.$5=[];this.$A=[];this.$E=[];this.$10=[];this.$12=[];this.$C=[];}
SpottedScript.Controls.CommentsDisplay._ThreadCommentsProvider.prototype={$0:0,$1:0,get_$2:function(){return this.$1;},set_$2:function($p0){this.$1=$p0;return $p0;},$3:0,get_$4:function(){return this.$3;},set_$4:function($p0){this.$3=$p0;return $p0;},$5:null,get_$6:function(){return this.$5[this.$1];},set_$6:function($p0){this.$5[this.$1]=$p0;return $p0;},$7:null,get_$8:function(){return this.$9(this.$1,this.$3);},set_$8:function($p0){if(!this.$7[this.$1]){this.$7[this.$1]=[];}(this.$7[this.$1])[this.$3]=$p0;return $p0;},$9:function($p0,$p1){if(!this.$7[$p0]){return null;}if(!(this.$7[$p0])[$p1]){return null;}return (this.$7[$p0])[$p1];},$A:null,get_$B:function(){return (this.$A[this.$1])?this.$A[this.$1]:0;},set_$B:function($p0){this.$A[this.$1]=$p0;return $p0;},$C:null,get_$D:function(){return (this.$C[this.$1])?this.$C[this.$1]:0;},set_$D:function($p0){this.$C[this.$1]=$p0;return $p0;},$E:null,get_$F:function(){return (this.$E[this.$1])?this.$E[this.$1]:0;},set_$F:function($p0){this.$E[this.$1]=$p0;return $p0;},$10:null,get_$11:function(){return (this.$10[this.$1])?this.$10[this.$1]:0;},set_$11:function($p0){this.$10[this.$1]=$p0;return $p0;},$12:null,get_$13:function(){return (this.$12[this.$1])?this.$12[this.$1]:0;},set_$13:function($p0){this.$12[this.$1]=$p0;return $p0;},$14:null,$15:null,$16:function($p0){if(this.get_$4()!==this.get_$B()){this.set_$4(this.get_$B());}if(!this.$1){this.$1=$p0.threadK;}if(!this.get_$8()){this.set_$8([$p0]);}else if(this.get_$8().length===this.$0){this.$3++;this.set_$B(this.get_$B()+1)-1;this.set_$8([$p0]);}else{this.get_$8()[this.get_$8().length]=$p0;}},$17:function($p0){for(var $0=0;$0<$p0.length;$0++){this.$16($p0[$0]);}},$18:function(){if(this.$1>0){if(!this.get_$8()){this.$1A();}else{this.$1D();}}},$19:function($p0,$p1){this.$1=$p0;this.$3=$p1;this.$1A();},$1A:function(){Spotted.WebServices.Controls.CommentsDisplay.Service.getThreadComments(this.$1,this.$3,((this.get_$6())?true:false)&&(this.get_$B()>0),Function.createDelegate(this,this.$1B),Function.createDelegate(this,this.$1C),null,-1);},$1B:function($p0,$p1,$p2){this.$3=$p0.currentPage;this.set_$8($p0.comments);if(!this.get_$6()){this.set_$6(($p0.initialComment)?$p0.initialComment:$p0.comments[0]);}if(!this.get_$B()){this.set_$B($p0.lastPage);}if(!this.get_$F()){this.set_$F($p0.firstUnreadPage);}if(!this.get_$13()){this.set_$13($p0.totalComments);}if(!this.get_$11()){this.set_$11($p0.viewComments);}this.$2A($p0.comments[$p0.comments.length-1].k);this.$1D();Spotted.WebServices.Controls.CommentsDisplay.Service.setThreadUsr(this.$1,this.$3,null,null,null,-1);},$1C:function($p0,$p1,$p2){this.$3=0;this.set_$8(null);this.set_$F(0);this.set_$6(null);this.set_$D(0);this.set_$B(0);this.set_$13(0);this.set_$11(0);this.$1D();},$1D:function(){if(this.$14){this.$14(this,Sys.EventArgs.Empty);}},$1E:null,$1F:function($p0){$p0.preventDefault();this.$20();this.$3--;this.$18();SpottedScript.Misc.redirectToAnchor(this.$1E);},$20:function(){SpottedScript.Controls.Banners.Generator.Controller.refreshAllBanners();},$21:function($p0){$p0.preventDefault();this.$20();this.$3++;this.$18();SpottedScript.Misc.redirectToAnchor(this.$1E);},$22:function($p0){$p0.preventDefault();this.$20();this.$3=$p0.target.getAttribute('pagenumber');this.$18();SpottedScript.Misc.redirectToAnchor(this.$1E);},$23:function(){var $0=document.createElement('p');$0.style.textAlign='right';var $1=document.createElement('a');var $2=document.createElement('img');$2.src='/gfx/icon-back-12.png';$2.style.border='0';$2.style.verticalAlign='middle';$1.appendChild($2);var $3=document.createElement('span');$3.innerHTML='prev page';$1.appendChild($3);if(this.$3>1&&this.get_$B()>1){$1.href='#';$addHandler($1,'click',Function.createDelegate(this,this.$1F));}else{$1.disabled=true;$1.className='DisabledAnchor';}$0.appendChild($1);var $4=document.createElement('span');$4.innerHTML='&nbsp;...&nbsp;';$0.appendChild($4);var $5=document.createElement('a');var $6=document.createElement('span');$6.innerHTML='next page';$5.appendChild($6);var $7=document.createElement('img');$7.src='/gfx/icon-forward-12.png';$7.style.border='0';$7.style.verticalAlign='middle';$5.appendChild($7);if(this.$3<this.get_$B()){$5.href='#';$addHandler($5,'click',Function.createDelegate(this,this.$21));}else{$5.disabled=true;$5.className='DisabledAnchor';}$0.appendChild($5);return $0;},$24:function(){var $0=document.createElement('p');var $1=document.createElement('span');$1.innerHTML='Pages: ';$0.appendChild($1);var $2=this.$25();var $3=false;for(var $4=1;$4<=this.get_$B();$4++){if($2[$4]){var $5=this.get_$F()>0&&this.get_$F()<=$4&&this.get_$11()<this.get_$13();var $6;if($4===this.$3){$6=document.createElement('span');$6.className=($5)?'CurrentPageUnread':'CurrentPage';}else{$6=document.createElement('a');$6.setAttribute('pagenumber',$4);($6).href='#Comments';$addHandler($6,'click',Function.createDelegate(this,this.$22));if($5){$6.className='Unread';}}$6.innerHTML=$4.toString();$0.appendChild($6);var $7=document.createElement('span');$7.innerHTML='&nbsp;';$0.appendChild($7);$3=false;}else{if(!$3){var $8=document.createElement('span');$8.innerHTML='...&nbsp;';if(this.get_$F()>0&&$4>this.get_$F()){$8.className='Unread';}$0.appendChild($8);$3=true;}}}return $0;},$25:function(){var $0=3;var $1=4;var $2=2;var $3=new Array(this.get_$B()+1);this.$26($3,1,$0);this.$26($3,this.get_$B()-$0+1,this.get_$B());if(this.get_$F()>0){this.$26($3,this.get_$F()-$2,this.get_$F()+$2-1);}this.$26($3,this.$3-$1,this.$3+$1);for(var $4=1;$4<$3.length-1;$4++){if($3[$4-1]&&!$3[$4]&&$3[$4+1]){$3[$4]=true;}}return $3;},$26:function($p0,$p1,$p2){for(var $0=$p1;$0<=$p2;$0++){$p0[$0]=true;}},$27:null,$28:function($p0){this.$29([$p0]);},$29:function($p0){this.$17($p0);this.set_$13(this.get_$13()+$p0.length);this.$2A($p0[$p0.length-1].k);this.$1D();},$2A:function($p0){if($p0>this.get_$D()){this.set_$D($p0);}},$2B:function($p0,$p1,$p2,$p3,$p4,$p5,$p6){Spotted.WebServices.Controls.CommentsDisplay.Service.createPublicThread($p0,$p1,$p2,$p3,$p4,$p5,$p6,Function.createDelegate(this,this.$2C),null,null,-1);},$2C:function($p0,$p1,$p2){SpottedScript.Misc.hideWaitingCursor();if($p0){if(!this.$1){this.$1=$p0.threadK;}if(this.$27){this.$27(null,new SpottedScript.IntEventArgs(this.$1));}if(this.$15){this.$15(null,new SpottedScript.IntEventArgs(this.$1));}this.$28($p0);}},$2D:function($p0,$p1,$p2,$p3,$p4,$p5,$p6){Spotted.WebServices.Controls.CommentsDisplay.Service.createNewPublicThread($p0,$p1,$p2,$p3,$p4,$p5,$p6,Function.createDelegate(this,this.$2E),null,null,-1);},$2E:function($p0,$p1,$p2){SpottedScript.Misc.hideWaitingCursor();SpottedScript.Misc.redirect($p0);},$2F:function($p0,$p1,$p2,$p3,$p4,$p5,$p6,$p7){Spotted.WebServices.Controls.CommentsDisplay.Service.createReply($p0,$p1,$p2,$p3,$p4,$p5,$p6,$p7,Function.createDelegate(this,this.$30),Function.createDelegate(null,Utils.Trace.webServiceFailure),null,-1);},$30:function($p0,$p1,$p2){SpottedScript.Misc.hideWaitingCursor();if($p0){this.$29($p0);if(this.$27){this.$27(this,Sys.EventArgs.Empty);}SpottedScript.Misc.redirectToAnchor('Anchor-CommentK-'+$p0[0].k);}},$31:function(){this.$5=[];this.$7=[];this.$A=[];this.$18();},$32:function(){this.set_$13(this.get_$13()-1)+1;}}
SpottedScript.Controls.CommentsDisplay.View=function(clientId){this.clientId=clientId;}
SpottedScript.Controls.CommentsDisplay.View.prototype={clientId:null,get_uiInitialCommentPanel:function(){return document.getElementById(this.clientId+'_uiInitialCommentPanel');},get_initialCommentH1:function(){return document.getElementById(this.clientId+'_InitialCommentH1');},get_uiInitialComment:function(){return document.getElementById(this.clientId+'_uiInitialComment');},get_uiInitialCommentDataList:function(){return document.getElementById(this.clientId+'_uiInitialCommentDataList');},get_uiCommentsAnchor:function(){return document.getElementById(this.clientId+'_uiCommentsAnchor');},get_uiCommentsPanel:function(){return document.getElementById(this.clientId+'_uiCommentsPanel');},get_commentsSubjectH1:function(){return document.getElementById(this.clientId+'_CommentsSubjectH1');},get_uiCommentsPanelClientSide:function(){return document.getElementById(this.clientId+'_uiCommentsPanelClientSide');},get_uiCommentsPanelServerSide:function(){return document.getElementById(this.clientId+'_uiCommentsPanelServerSide');},get_commentsPageP1:function(){return document.getElementById(this.clientId+'_CommentsPageP1');},get_commentsPrevPageLink1:function(){return document.getElementById(this.clientId+'_CommentsPrevPageLink1');},get_commentsNextPageLink1:function(){return document.getElementById(this.clientId+'_CommentsNextPageLink1');},get_commentsPagesP1:function(){return document.getElementById(this.clientId+'_CommentsPagesP1');},get_commentsDataList:function(){return document.getElementById(this.clientId+'_CommentsDataList');},get_commentsPagesP2:function(){return document.getElementById(this.clientId+'_CommentsPagesP2');},get_commentsPageP2:function(){return document.getElementById(this.clientId+'_CommentsPageP2');},get_commentsPrevPageLink:function(){return document.getElementById(this.clientId+'_CommentsPrevPageLink');},get_commentsNextPageLink:function(){return document.getElementById(this.clientId+'_CommentsNextPageLink');},get_uiPageNumber:function(){return document.getElementById(this.clientId+'_uiPageNumber');},get_uiClientID:function(){return document.getElementById(this.clientId+'_uiClientID');},get_uiCommentsPerPage:function(){return document.getElementById(this.clientId+'_uiCommentsPerPage');},get_uiUsrIsLoggedIn:function(){return document.getElementById(this.clientId+'_uiUsrIsLoggedIn');}}
SpottedScript.Controls.CommentsDisplay.CommentStub.registerClass('SpottedScript.Controls.CommentsDisplay.CommentStub');
SpottedScript.Controls.CommentsDisplay.CommentResult.registerClass('SpottedScript.Controls.CommentsDisplay.CommentResult');
SpottedScript.Controls.CommentsDisplay.Controller.registerClass('SpottedScript.Controls.CommentsDisplay.Controller');
SpottedScript.Controls.CommentsDisplay._Properties.registerClass('SpottedScript.Controls.CommentsDisplay._Properties');
SpottedScript.Controls.CommentsDisplay._ThreadCommentsProvider.registerClass('SpottedScript.Controls.CommentsDisplay._ThreadCommentsProvider');
SpottedScript.Controls.CommentsDisplay.View.registerClass('SpottedScript.Controls.CommentsDisplay.View');
SpottedScript.Controls.CommentsDisplay._Properties.$0='ConfirmText';
SpottedScript.Controls.CommentsDisplay._Properties.$1='CommentK';
SpottedScript.Controls.CommentsDisplay._Properties.$2='UsrK';
