
function createCounters() {
    //console.log("createCounters");
    for (var aClock in counterArray) {
        counterArray[aClock].stop();
    };
    counterArray.length = 0;
    
    // get game clock
    var clockDuration = document.getElementById("gameClock").innerHTML;
    var clock = new Counter("gameClock", clockDuration);
    
    //console.log("gameClock: "+clock);
    counterArray.push(clock);
    
    updateCounters();
}

function setBallLocation() {
    var anElement = document.getElementById("ballOn");
    var ballLocation = anElement.value;
    var paramString = "action=updateBallLocation+tag="+ballLocation;
    
    // post the string, asking the server for the preview string using these token fields
    $.ajax({
           type: "POST",
           url: "/html/scoreBoard",
           data: paramString,
           cache: false,
           success: function(html) {
           // no update
           }
    });
}

function firstDown() {
    var paramString = "action=firstDown";
    var downValueBox = document.getElementById("downValueBox");
    var toGoValueBox = document.getElementById("toGoValueBox");
    
    // post the string, asking the server for the preview string using these token fields
    $.ajax({
           type: "POST",
           url: "/html/scoreBoard",
           data: paramString,
           cache: false,
           success: function(html) {
                downValueBox.innerHTML = "1";
                toGoValueBox.innerHTML = "10";
           }
    });
}