/* TF2Lobby.com
 * Copyright 2010 Ryan "FLOOR_MASTER" Mannion. All rights reserved.
 * The contents of this file may not be used in any other context than
 * tf2lobby.com without permission
 */

String.prototype.htmlEncode=function(){var a=document.createElement("div");a.appendChild(document.createTextNode(this));return a.innerHTML};String.secondsToDateTime=function(b){var c=new Date();c.setTime(b*1000);var a=c.getFullYear()+(c.getMonth()<9?"-0":"-")+(c.getMonth()+1)+(c.getDate()<10?"-0":"-")+c.getDate()+" "+String.secondsToTimestamp(b);return a};String.secondsToTimestamp=function(b){var c=new Date();c.setTime(b*1000);var a=(c.getHours()<10?"0":"")+c.getHours()+(c.getMinutes()<10?":0":":")+c.getMinutes()+(c.getSeconds()<10?":0":":")+c.getSeconds();return a};String.truncate=function(b,a){if(b.length>a){return b.substr(0,a-3)+"..."}else{return b}};String.durationToSeconds=function(c){var b=0;var a;if((a=c.match(/(\d+)d/))!=null){b+=parseInt(a[1])*86400}if((a=c.match(/(\d+)h/))!=null){b+=parseInt(a[1])*3600}if((a=c.match(/(\d+)m/))!=null){b+=parseInt(a[1])*60}if((a=c.match(/(\d+)s/))!=null){b+=parseInt(a[1])}return b};String.secondsToDuration=function(b){var a=new Array();if(b>=86400){a.push(parseInt(b/86400)+"d");b%=86400}if(b>=3600){a.push(parseInt(b/3600)+"h");b%=3600}if(b>=60){a.push(parseInt(b/60)+"m");b%=60}a.push(parseInt(b)+"s");return a.join(" ")};Object.size=function(c){var b=0;for(var a in c){if(c.hasOwnProperty(a)){b++}}return b};function closeDialog(a){$("#"+a).dialog("close")}function Tooltip(){return this}Tooltip.prototype.setup=function(c,a){var b=this;c.mouseover(function(d){b.show(d,a)}).mouseout(function(d){b.hide()}).mousemove(function(d){b.move(d)});return c};Tooltip.prototype.clear=function(a){a.unbind("mouseover").unbind("mouseout").unbind("mousemove")};Tooltip.prototype.show=function(b,a){$("#tooltip").css({left:(b.pageX+20)+"px",top:(b.pageY+20)+"px"}).html(a).stop().css("opacity",1).fadeIn("fast")};Tooltip.prototype.move=function(a){if(window.disableTooltip){this.hide()}else{$("#tooltip").css({left:(a.pageX+20)+"px",top:(a.pageY+20)+"px"})}};Tooltip.prototype.hide=function(){$("#tooltip").stop().css("opacity",0).fadeOut("fast")};