var enPlayers = new Array(); var enAlliances = new Array(); var lsPlayers = new Array(); var lsAlliances = new Array(); var update; var enltt; function Enemy(id,name) { this.id = id; this.name = name; this.selected = false; } function parseData(data) { if (data == "ERR#200") { alertRemoveVacation(); return; } var l = data.split('\n'); var pl, al, t; pl = enPlayers; al = enAlliances; enPlayers = new Array(); lsPlayers = new Array(); enAlliances = new Array(); lsAlliances = new Array(); while (l.length > 0) { var a = l.shift().split('#'); var tp = a.shift(), id = a.shift(); if (tp == 0) { if (pl[id]) t = pl[id]; else t = new Enemy(id, a.join('#')); enPlayers[id] = t; lsPlayers.push(t); } else { if (al[id]) t = al[id]; else t = new Enemy(id, a.join('#')); enAlliances[id] = t; lsAlliances.push(t); } } } function initList() { var data = document.getElementById('elinit').innerHTML; if (data != "") { if (data.split('#').length > 3 && data.indexOf('\n') == -1) { // IE really sucks. x_getEnemies(updatePage); return; } parseData(data); } displayPage(); } function updatePage(data) { if (data == "") { enPlayers = new Array(); lsPlayers = new Array(); enAlliances = new Array(); lsAlliances = new Array(); } else { parseData(data); } displayPage(); } function displayPage() { drawList('eal', lsAlliances, "lsAlliances"); drawList('epl', lsPlayers, "lsPlayers"); update = setTimeout('x_getEnemies(updatePage)', 60000); } function drawList(lid, lst, lsn) { if (lst.length == 0) { document.getElementById(lid + 'div').innerHTML = '

' + emptyListText + '

'; return; } lst.sort(new Function('a','b','return (a.name.toLowerCase()>b.name.toLowerCase())?1:-1')); var i, str = ''; var nr = (lst.length % 2) + (lst.length - (lst.length % 2)) / 2; for (i=0;i '; } str += ''; if (i%2 == 1) str += ''; } if (i%2 == 1) str += ''; str += '
'+lst[i].name+'
 
 
'; document.getElementById(lid + 'div').innerHTML = str; updateButton(lid, lst, lsn); } function updateButton(lid, lst, lsn) { var i; for (i=0;i'); } function listRemove(lst, lsn) { var i, lids = new Array(); for (i=0;i