var topicList = new TopicList();

function grabChannel(channelElement) {
    channelElement.value = document.getElementById("channel").value;
}

function grabNick(nickElement) {
    nickElement.value = document.getElementById("nick").value;
}

function abbrev(string) {
    if (string.length > 15) {
        return string.substring(0, 15) + "...";
    }
    else {
        return string;
    }
}

function lobbyInit() {
    window.document.lobby.SetVariable("host", getHostName());
    window.document.lobby.SetVariable("port", 32899);
    window.document.lobby.TCallLabel("\/", "connect");
}

function lobbyData(data) {
    topicList.update(data);
}

function lobbyConnected(yes) {
    if (yes) {
        window.document.lobby.SetVariable("data", "<");
        window.document.lobby.TCallLabel("\/", "send");
        topicList.printList();
    }
    else {
        document.getElementById("list").innerHTML = "you are a loser";
    }
}

function lobbyClosed() {

}