var lsAllies = new Array(), idAllies = new Array(); var lsRAllies = new Array(), idRAllies = new Array(); var lsBans = new Array(), idBans = new Array(); var tratt; function TrustedAlly(id,name) { this.id = id; this.name = name; this.selected = false; } function ReverseAlly(id,level,name) { this.id = id; this.name = name; this.level = parseInt(level,10); this.selected = false; } function BannedPlayer(id,name) { this.id = id; this.name = name; this.selected = false; } function parseData(data) { var list = new Array(); var byId = new Array(); var l = data.split('\n'); var na, nr, nb; var i, a, t, id; a = l.shift().split('#'); na = parseInt(a[0], 10); nr = parseInt(a[1], 10); nb = parseInt(a[2], 10); for (i=0;i 3) x_getTrusted(listReceived); else listReceived(data); } function listReceived(data) { parseData(data); displayPage(); update = setTimeout('x_getTrusted(listReceived)', 600000); } function displayPage() { var str = ""; var e = document.getElementById('newally'); if (lsAllies.length < 5) str += drawAddAlly(e ? e.value : ""); str += drawAllyList(); document.getElementById('allies').innerHTML = str; document.getElementById('rallies').innerHTML = drawReverseList(); document.getElementById('bans').innerHTML = drawBlackList(); updateButtons(); updateRButtons(); updateBLButtons(); } function handleCommand(data) { if (data.indexOf('ERR#') == 0) { var ei = parseInt(data.replace(/ERR#/, ''), 10); commandAlert(ei); update = setTimeout('x_getTrusted(listReceived)', 600000); } else { var e = document.getElementById('newally'); if (e) { e.value = ''; } listReceived(data); } } function drawAllyList() { var i, str = '

' + listTitle + '

'; if (lsAllies.length == 0) return str + '

' + emptyList + '

'; str += ''; for (i=0;i '; str += ''; } str += '
' + lsAllies[i].name + '
 
 
'; return str; } function updateButtons() { if (!document.getElementById('buttons')) return; var i, cr = false, cmu = true, cmd = true; for (i=0;i" + notTrusted + "

"; var str = ''; str += ''; str += ''; var i; lsRAllies.sort(new Function('a','b','return a.name.toLowerCase()>b.name.toLowerCase()?1:-1')); for (i=0;i' + lsRAllies[i].name + '' + ''; } str += '
  '+raHeaders[0]+'' + raHeaders[1] + '
' + (lsRAllies[i].level + 1) + '
 
 
'; return str; } function updateRButtons() { if (!document.getElementById('rbuttons')) return; var i; for (i=0;i

' + addBanLabel + '

' + blackListTitle + '

'; if (lsBans.length == 0) return str + '

' + emptyBlackList + '

'; str += ''; for (i=0;i '; str += ''; } str += '
' + lsBans[i].name + '
 
  
'; return str; } function updateBLButtons() { if (!document.getElementById('blbuttons')) return; var i; for (i=0;i0) ? pname.substr(0, i) : ""; var s2 = (i