var sid="";var FSpy=Class.create();FSpy.prototype={initialize:function(){this.rows=new Array();var a=new Date();this.lastUpdate=a.getTime()-(1000*60*60*24*7);new IdlingPeriodicalExecuter(this.update.bind(this),this.refreshTime/1000,false,"forumSpy.js")},refreshTime:10000,numFade:5,numTotal:15,lineLengthMax:135,rowFormat:"",rowType:"",insertionPoint:null,lastUpdate:0,showing:0,rows:null,lastMid:0,firstUpdate:true,alignLeft:true,categoryId:-1,checkUnread:false,tssFormat:"HMIL:MINUTE",debugMode:false,system:null,init:function(){if(window.location.search.indexOf("spybug")>-1){this.debugMode=true;if(Prototype.Browser.IE){var b=document.createElement("script");b.src="/js/firebugLite/firebug.js";document.body.appendChild(b)}}var c=$("spyRowFormat");this.rowFormat=c.innerHTML;this.rowType=c.nodeName;this.insertionPoint=c.previous();
c.remove();var a=this;$$(".spyPrePopulated").each(function(e,d){e.id="prepop-"+d;a.rows.unshift(e)})},expandMessage:function(k){var i=this;var j=i.select(".spyExtraText")[0];if(!j){return}if(j.effect){j.effect.cancel()}var l=i.getDimensions();var g=i;var d=0,h=0;do{d+=g.offsetTop||0;h+=g.offsetLeft||0;g=g.offsetParent;if(g){if(g.tagName=="BODY"){break}var b=Element.getStyle(g,"position");if(b=="relative"||b=="absolute"){break}}}while(g);var c=Element._returnOffset(h,d);var a=-15;var f=-1;if(Prototype.Browser.WebKit){f=0}if(Prototype.Browser.IE){a=1}j.setStyle({position:"absolute",top:c.top+l.height-8,left:c.left+f,width:l.width+a});j.show()},hideMessage:function(b){var c=this;var a=c.select(".spyExtraText")[0];if(!a){return}if(a.effect){a.effect.cancel()}a.hide()},update:function(){var b=this;var a=function(g){var e=b;
var d=JSON.parse(g.responseText);b.lastUpdate=new Date().getTime()-10*1000;posts=$A(d.posts);posts.each(function(o,j){var l=false;b.rows.each(function(r){if(r.id==o.topic.mid){l=true}});if(!l&&o.topic.mid>b.lastMid){b.lastMid=o.topic.mid;var m=b.formatRow(o);var h=document.createElement(b.rowType);h=Element.extend(h);var p=false;var i=new Array();var k=m.toLowerCase();while(k.indexOf("<td")>-1){p=true;var q=k.indexOf("<td");var n=k.indexOf("</td>");i.push(m.substring(q+4,n).gsub('align="left">',"").gsub("align=left>",""));m=m.substring(n+5,m.length);k=m.toLowerCase()}if(p){i.each(function(s,r){var t=Element.extend(document.createElement("td"));t.innerHTML=s;if(b.alignLeft){t.align="left"}h.appendChild(t)})}else{h.innerHTML=m}h.id=o.topic.mid;b.insertionPoint.insert({after:h});b.rows.unshift(h);if(!b.firstUpdate){h.effect=new Effect.Highlight(h,{duration:6,startcolor:"#440000",endcolor:"#000000"})
}}});if(b.firstUpdate){b.firstUpdate=false}while(b.rows.length>b.numTotal){var f=b.rows.pop();f.remove()}};var c="?l="+this.numTotal+"&c="+this.categoryId+"&u="+this.checkUnread;if(this.lastUpdate!=null){c+="&s="+this.lastUpdate}if(this.system!=null){c+="&sys="+this.system}new Ajax.Request("/spy.do"+sid+c,{onComplete:a})},formatRow:function(row){var f=this.rowFormat;f=f.gsub("#sid#",sid);var icons="";if(row.topic.attach&&row.topic.video){icons+='<img border="0" src="/img/forum/tforums/picVidAttached.gif"/>'}else{if(row.topic.video){icons+='<img border="0" src="/img/forum/tforums/vidAttached.gif"/>'}else{if(row.topic.attach){icons+='<img border="0" src="/img/forum/tforums/picAttached.gif"/>'}}}if(row.topic.sticky){icons+='<img border="0" src="/img/forum/tforums/down.gif" width="11" height="11">'}if(row.topic.bulletin){icons+='<img border="0" src="/img/forum/tforums/bulletin.gif" width="16" height="12">'
}f=f.gsub("#topicIcons#",icons);var ix0=f.indexOf("#if photoRating#");var ix1=f.indexOf("#/if photoRating#")+"#/if photoRating#".length;if(ix0>-1&&ix1>-1){if(row.topic.isPhotoRating){f=f.gsub("#if photoRating#","");f=f.gsub("#/if photoRating#","")}else{f=f.substring(0,ix0)+f.substring(ix1,f.length)}}var ix0=f.indexOf("#if visited#");var ix1=f.indexOf("#/if visited#")+"#/if visited#".length;while(ix0>-1&&ix1>-1){if(!row.topic.unread){f=f.gsub("#if visited#","");f=f.gsub("#/if visited#","")}else{f=f.substring(0,ix0)+f.substring(ix1,f.length)}ix0=f.indexOf("#if visited#");ix1=f.indexOf("#/if visited#")+"#/if visited#".length}var dateFormat=eval("formatDateTime("+row.topic.tssParams+',"'+this.tssFormat+'")');f=f.gsub("#topic.tssLastPostDate#",dateFormat);if(row.topic.subject&&row.topic.subject.length>35){row.topic.subject=row.topic.subject.substring(0,35)+"..."
}var lmlen=this.lineLengthMax;if(Prototype.Browser.IE){lmlen-=10}if(row.topic.lastMessage&&row.topic.lastMessage.length>lmlen){row.topic.lastMessage=row.topic.lastMessage.substring(0,lmlen)+"..."}return this.formatHashed(f,row)},formatHashed:function(g,d){while(g.indexOf("#")>-1){var c=g.indexOf("#");var i=g.indexOf("#",c+1);var e=g.substring(c+1,i);if(e.indexOf(".")>-1){var b=e.substring(0,e.indexOf("."));var h=e.substring(e.indexOf(".")+1,e.length);var f=d[b][h]+"";f=f.gsub("#","");g=g.gsub("#"+e+"#",f)}else{var f=d[e]+"";f=f.gsub("#","");g=g.gsub("#"+e+"#",f)}}return g}};var fsp=new FSpy();var fspInterval=null;function forumSpyInit(){fsp.init()}function forumSpyUpdate(){fsp.update()}Event.observe(window,"load",forumSpyInit);