function decrypt(txt){var outtxt="",c='',i;for(i=3;i<txt.length;i++){c=txt.charCodeAt(i);if(c!=32&&c!=126){c=c-i-txt.charCodeAt(i%3)-33;while(c<33)c+=92;}outtxt+=String.fromCharCode(c);}document.write(outtxt);}
var onload_funcs='',sPA1=false,scs=[],flashunits=[];
function popHelp(page){window.open('http://www.game-monitor.com/help.php?page='+page,'helpwindow','width=400,height=350,menubar=no,status=no,location=no,directories=no,resizable=no');}
function popHelp2(page,extra){window.open('http://www.game-monitor.com/help.php?page='+page+'&extra='+extra,'helpwindow','width=400,height=350,menubar=no,status=no,location=no,directories=no,resizable=no');}
function gm_setV(id,v){gm_getEBI(id).value=v;}
function gm_getEBI(id){return document.getElementById(id);}
function gm_getEBN(id){return document.getElementsByName(id);}
function gm_aNLI(){alert('You must log in first to make use of this function');}
function res_setBGC(o,c){if(o.style.backgroundColor!='rgb(238, 238, 255)'&&o.style.backgroundColor!='#eeeeff'){o.style.background=c;return true;}return false;}
function res_ovr(o){
	if(typeof(o)!='object'){
		var e=gm_getEBN('r'+o);
		for(var i=0;i<e.length;i++)this.res_ovr(e[i]);
	}else{
		res_setBGC(o,'#EEE');
	}
}
function res_out(o){
	if(typeof(o)!='object'){
		var e=gm_getEBN('r'+o);
		for(var i=0;i<e.length;i++)this.res_out(e[i]);
	}else{
		res_setBGC(o,'#FFF');
	}
}
function res_clk(o){if (!res_setBGC(o,'#EEEEFF'))o.style.background='#EEE';}
function set_showFull(){gm_setV('showFull',((gm_getEBI('vShowFull').checked==true)?'Y':'N'));}
function set_showEmpty(){gm_setV('showEmpty',((gm_getEBI('vShowEmpty').checked==true)?'Y':'N'));}
function aja_favorite(obj,ip,img){
	var oimg=gm_getEBI('af'+obj),mode='',oa=gm_getEBN('r'+obj);
	if(oa[0].style.backgroundColor!='rgb(238, 238, 255)' && oa[0].style.backgroundColor!='#eeeeff'){
		mode='set';
		if(oimg){
			oimg.src='/images/delfav.gif';
			oimg.title='Remove from favorites';
		}
	}else{
		mode='del';
		if(oimg){
			oimg.src='/images/addfav.gif';
			oimg.title='Add to favorites';
		}
	}
	setupAajQuery('aja_favcm','server-favorite.php','ip='+ip+'&c='+mode,[obj,mode]);
}
function aja_favcm(ret,obj,mode){
	var o=gm_getEBN('r'+obj);
	for(var i=0;i<o.length;i++)if(ret=='1'&&(mode=='del'||mode=='set'))o[i].style.background=(mode=='del'?'#FFF':'#EEEEFF');
}
function aja_setUserPref(upg,name,value){setupAajQuery('aja_sUPd','userPrefs.php','upg='+upg+'&upn='+name+'&upv='+value);}
function aja_sUPd(ret){
	if(ret=='1'||ret=='2'){
	}else if(ret=='-1'){
		if(!sPA1){sPA1=true;alert('You must be logged in to save this preference, or it will just keep reverting.');}
	}
}
function userPref_ToggleWindow(upg,name,obj,toggleOn,toggleOff){
	var o=gm_getEBI(obj),sVal=0;
	if(o.style.display=='none'){
		sVal=1;o.style.display='block';
		if(typeof(toggleOn)!='undefined')eval(toggleOn);
	}else{
		sVal=0;o.style.display='none';
		if(typeof(toggleOff)!='undefined')eval(toggleOff);
	}
	aja_setUserPref(upg,name,sVal);
}
function gameChange(frm){if(gm_getEBI('gameSelect').options[gselect.selectedIndex].value=='other')frm.submit();}
function linkCompare(ip,ipc){
	var ip2=ipc;
	if(ip2){
	}else{
		ip2=gm_getEBI('compare_ip').value;
	}
	if(isIPAddress(ip2)){
		document.location.href='/GameServerCompare/'+ip+'/'+ip2+'/';
	}else{
		alert('Please enter the IP Address of the server. (ie: '+ip+')');
	}
}
function isIPAddress(ip,l){
	var iplen=(l||10),c=0,i;
	if(ip.length<iplen)return false;
	for(i=0;i<ip.length;i++){
		c=ip.charAt(i);
		if((c!='.'&&c<'0')||c>':')return false;
	}
	return true;
}
function tzO(){return -(new Date()).getTimezoneOffset()/60;}
function onload_addFunction(func){onload_funcs+=func+'();';}
function onload_executeFunctions(){eval(onload_funcs);}
function geoip_getCountries(func,paras){setupAajQuery(func,'geoip.php','t=c',paras);}
function geoip_getRegions(c,func,paras){setupAajQuery(func,'geoip.php','t=r&c='+c,paras);}
function geoip_CountrySelect(name){geoip_getCountries('geoip_CountrySelectP',[name]);}
function geoip_CountrySelectP(txt,name){
	var obj=gm_getEBI(name),p=txt.split("\n");
	var c,ol=obj.options.length,i;
	for(i=0;i<p.length;i++){
		c=eval(p[i]); if(c)obj.options[ol+i]=new Option(c[1],c[0]);
	}
}
function geoip_RegionSelect(name,c){
	var obj=gm_getEBI(name);
	obj.options.length=0;
	obj.options[0]=new Option('... Loading ...',-1);
	geoip_getRegions(c,'geoip_RegionSelectP',[name]);
}
function geoip_RegionSelectP(txt,name){
	var obj=gm_getEBI(name),p=txt.split("\n"),i;
	obj.options.length=0;
	var c,ol=obj.options.length+1;
	obj.options[0]=new Option('.. Choose a Region ..',-1);
	for(i=0;i<p.length;i++){
		c=eval(p[i]); if(c)obj.options[ol+i]=new Option(c[1]+','+c[2],c[0]);
	}
}
function verifyIpCorrection(){
	var e='',v=gm_getEBI('ipl').value,psa='Please select a ';
	if(!isIPAddress(v,7))e+='Invalid starting ip ('+v+")\n";
	v=gm_getEBI('iplend').value;
	if(!isIPAddress(v,7))e+='Invalid ending ip ('+v+")\n";
	v=gm_getEBI('countryID').value;
	if(v<=0)e+=psa+'country';
	v=gm_getEBI('regionID').value;
	if(v<=0)e+=psa+'region';
	if(e=='')return true;
	alert(e);return false;
}
function grabSearchCounters(){
	var e=gm_getEBN('lus'),ut=Math.floor((new Date()).getTime()/1000),i;
	if(e.length>0){
		for(i=0;i<e.length;i++)scs[i]=ut-e[i].innerHTML;
		updateSearchCounters();
	}
}
function updateSearchCounters(){
	var e=gm_getEBN('lus'),ut=Math.floor((new Date()).getTime()/1000),t,ts,tm,i;
	for(i=0;i<e.length;i++){
		t=(ut-scs[i]);tm=Math.floor(t/60);ts=t-tm*60;
		if(ts<10)ts='0'+ts;
		e[i].innerHTML=tm+'m'+ts;
	}
	setTimeout('updateSearchCounters()',1500);
}
function flashHTML(url,w,h,p){
	var e='',i;
	if(p)for(i=0;i<p.length;i=i+2)e+=(e!=''?'&':'')+p[i]+'='+p[i+1].replace(/&/g,"%26");
	if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length) return '<embed src="'+url+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'" flashvars="'+e+'"></embed>';
	return '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="'+w+'" height="'+h+'"><param name="movie" value="'+url+'"><param name="quality" value="high"><param name="flashvars" value="'+e+'"></object>';
}
function insertFlash(url,w,h){document.write(flashHTML(url,w,h));}
function setupFlash(id,url,w,h,p){var i=flashunits.length;if(i==0)onload_addFunction('runFlash');flashunits[i]={"id":id,"txt":flashHTML(url,w,h,p)};}
function runFlash(){for(var i=0;i<flashunits.length;i++){(gm_getEBI(flashunits[i].id)).innerHTML=flashunits[i].txt;}}

function showGraphs(i,r){
	var o=document.getElementById(i);
	o.innerHTML='<img src="http://graphs.game-monitor.com/search-result-image.php?sid='+r+'&i=p" />&nbsp;<img src="http://graphs.game-monitor.com/search-result-image.php?sid='+r+'" />';
}
