var packlist=new packlist();function goTop(acceleration,time){acceleration=acceleration||0.2;time=time||15;var dx=0;var dy=0;var bx=0;var by=0;if(document.documentElement){dx=document.documentElement.scrollLeft||0;dy=document.documentElement.scrollTop||0}if(document.body){bx=document.body.scrollLeft||0;by=document.body.scrollTop||0}var wx=window.scrollX||0;var wy=window.scrollY||0;var x=Math.max(wx,Math.max(bx,dx));var y=Math.max(wy,Math.max(by,dy));var speed=1+acceleration;window.scrollTo(Math.floor(x/speed),Math.floor(y/speed));if(x>0||y>0){var invokeFunction="goTop("+acceleration+", "+time+")";window.setTimeout(invokeFunction,time)}}function packlist(){this.packs=new Array();this.last="";this.init=function(){this.table=document.getElementById('listtable');this.start=document.getElementById('start');this.status=document.getElementById('status');this.none=document.getElementById('none');window.searchdiv=document.getElementById('searchdiv');window.onscroll=this.onscroll};this.ajax_init=function(){try{this.ajax_request=new XMLHttpRequest()}catch(trymicrosoft){try{this.ajax_request=new ActiveXObject("Msxml2.XMLHTTP")}catch(othermicrosoft){try{this.ajax_request=new ActiveXObject("Microsoft.XMLHTTP")}catch(failed){this.ajax_request=null}}}if(!this.ajax_request)alert("Sorry, your browser is to old. To use this page, please make yourself happier and download a newer browser.")};this.onscroll=function(){var scrollY=packlist.getScrollY();if(scrollY>76){this.searchdiv.style.top=(scrollY-79)+"px"}else{this.searchdiv.style.top="0px"}};this.flush=function(){this.none.style.display='none';this.start.style.display='none';this.table.deleteTFoot();if(this.packs.length<1){this.none.style.display=''}else{this.table.createTFoot();var tfoot=this.table.getElementsByTagName('tFoot')[0];var total=0;for(i=0;i<this.packs.length;i++){var size=(this.packs[i]['size']==0)?"<1":this.packs[i]['size'];total+=this.packs[i]['size'];size+="M";tfoot.insertRow(i);tfoot.rows[i].className="anime"+(i%2);tfoot.rows[i].onclick=function(){packlist.genCommand(this)};tfoot.rows[i].insertCell(0);tfoot.rows[i].cells[0].className="name";tfoot.rows[i].cells[0].innerHTML=this.packs[i]['name'];tfoot.rows[i].insertCell(0);tfoot.rows[i].cells[0].className="number";tfoot.rows[i].cells[0].innerHTML=size;tfoot.rows[i].insertCell(0);tfoot.rows[i].cells[0].className="number";tfoot.rows[i].cells[0].innerHTML=this.packs[i]['number'];tfoot.rows[i].insertCell(0);tfoot.rows[i].cells[0].className="number";tfoot.rows[i].cells[0].innerHTML=this.packs[i]['bot']}}this.status.style.display='none'};this.genCommand=function(row){var nick=row.cells[0].innerHTML;var pack=row.cells[1].innerHTML;prompt('Paste this in your irc client:','/msg '+nick+' xdcc send #'+pack)};this.search=function(){if(document.getElementById('search').value!=""&&document.getElementById('search').value!=" "){var search=document.getElementById('search').value.replace(/\+/ig,"%2B");this.request("t="+search);this.last="?search="+search}else{this.none.style.display='none';this.start.style.display='';this.table.deleteTFoot()}};this.nickPacks=function(nick){this.request("nick="+nick);this.last="?nick="+nick};this.numberAsc=function(a,b){var x=a.number;var y=b.number;return((x<y)?-1:((x>y)?1:0))};this.numberDesc=function(a,b){var x=a.number;var y=b.number;return((x<y)?1:((x>y)?-1:0))};this.sizeAsc=function(a,b){var x=a.size;var y=b.size;return((x<y)?-1:((x>y)?1:0))};this.sizeDesc=function(a,b){var x=a.size;var y=b.size;return((x<y)?1:((x>y)?-1:0))};this.nameAsc=function(a,b){var x=a.name.toLowerCase();var y=b.name.toLowerCase();return((x<y)?-1:((x>y)?1:0))};this.nameDesc=function(a,b){var x=a.name.toLowerCase();var y=b.name.toLowerCase();return((x<y)?1:((x>y)?-1:0))};this.botAsc=function(a,b){var x=a.bot.toLowerCase();var y=b.bot.toLowerCase();return((x<y)?-1:((x>y)?1:0))};this.botDesc=function(a,b){var x=a.bot.toLowerCase();var y=b.bot.toLowerCase();return((x<y)?1:((x>y)?-1:0))};this.request=function(request){request="search.php?"+request;this.center_status();this.ajax_init();this.ajax_request.onreadystatechange=this.ajax_callback;this.ajax_request.open("GET",request,true);this.ajax_request.send(null);pageTracker._trackPageview("/m33w/"+request)};this.ajax_callback=function(){if(packlist.ajax_request.readyState==4&&packlist.ajax_request.status==200){packlist.packs=new Array();eval(packlist.ajax_request.responseText);packlist.flush()}};this.center_status=function(){var my_width=0;var my_height=0;if(typeof(window.innerWidth)=='number'){my_width=window.innerWidth;my_height=window.innerHeight}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){my_width=document.documentElement.clientWidth;my_height=document.documentElement.clientHeight}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){my_width=document.body.clientWidth;my_height=document.body.clientHeight}this.status.style.position='absolute';this.status.style.display='block';this.status.style.zIndex=-1;var divheight=parseInt(this.status.style.height,10)?parseInt(this.status.style.height,10):parseInt(this.status.offsetHeight,10);var divwidth=parseInt(this.status.style.width,10)?parseInt(this.status.style.width,10):parseInt(this.status.offsetWidth,10);divheight=divheight?divheight:200;divwidth=divwidth?divwidth:400;var scrollY=this.getScrollY();var setX=(my_width-divwidth)/2;var setY=(my_height-divheight)/2+scrollY;setX=(setX<0)?0:setX;setY=(setY<0)?0:setY;this.status.style.left=setX+"px";this.status.style.top=setY+"px";this.status.style.zIndex=99};this.getScrollY=function(){var scrollY=0;if(document.documentElement&&document.documentElement.scrollTop){scrollY=document.documentElement.scrollTop}else if(document.body&&document.body.scrollTop){scrollY=document.body.scrollTop}else if(window.pageYOffset){scrollY=window.pageYOffset}else if(window.scrollY){scrollY=window.scrollY}return scrollY}}

