
var gameType="";var ModDir="";var mapName="";function str_pad(str,length,padding)
{while(str.length<length)
{str=padding+str;}
return str;}
function Seconds2Time(seconds)
{var hours=Math.floor(seconds/3600);seconds=seconds%3600;var minutes=Math.floor(seconds/60);seconds=seconds%60;return str_pad(hours.toString(),2,'0')+':'+str_pad(minutes.toString(),2,'0')+':'+str_pad(seconds.toString(),2,'0');}
function hlsw_gameserver(gametype,address){this.gametype=gametype;this.address=address;this.data=null;this.id=0;this.key=null;this.rcon_enabled=false;this.rcon_flags={extraport:false,username:false};this.username='';this.password='';this.extraport=0;this.object=null;this.getServerInfo=function(){var self=this;$.ajax({url:'http://xmllive.hlsw.org:25000/jsonp/serverquery/'+this.gametype+'/'+this.address+'/rcon',dataType:'jsonp',data:{},success:function(data){self.serverInfoReceived(data);self.rcon_flags.extraport=data.rcon.port;self.rcon_flags.username=data.rcon.username;self.data=data;},error:function(x,data,e){self.serverInfoError(x,data,e);}});};this.serverInfoReceived=function(data){};this.serverInfoError=function(x,data,e){}
this.rconStartSession=function(username,password){this.username=username;this.password=password;var self=this;$.ajax({url:'http://xmllive.hlsw.org:25000/jsonp/rconstart/'+self.gametype+'/'+self.address+'/'+self.password+'/'+self.username+'?'+user_auth,dataType:'jsonp',data:{},success:function(data){self.key=data.Key;self.id=data.Id;self.rcon_enabled=true;self.rconSessionConnected();self.rconSessionReceiveLoop(self);},error:function(x,data,e){self.rconSessionError(x,data,e);}});};this.rconSendCommand=function(command){var self=this;var cmd=encodeURIComponent(command);$.ajax({url:'http://xmllive.hlsw.org:25000/jsonp/rconsend/'+self.id+'/'+self.key+'/'+cmd,dataType:'jsonp',data:{},success:function(data){self.rconSendOk();},error:function(x,data,e){self.rconSessionError(x,data,e);}});};this.rconSendOk=function(){}
this.rconSessionReceiveLoop=function(instance){$.ajax({url:'http://xmllive.hlsw.org:25000/jsonp/rconget/'+instance.id+'/'+instance.key,dataType:'jsonp',data:{},success:function(data){instance.rconSessionDataArrived(data);setTimeout(function(){instance.rconSessionReceiveLoop(instance);},500);},error:function(x,data,e){instance.rconSessionError(x,data,e);}});};this.rconSessionDataArrived=function(data){};this.rconSessionConnected=function(){};this.rconSessionError=function(x,data,e){};this.rconSessionDisconnected=function(){};}