// -- firstly, let's create an alias for document.getElementById()
function $(id)
{
    return document.getElementById(id);
}

function flickAllCheckboxes(tick)
{
    /* -- get all the INPUT tags for this ID -- */
    var boxes=$("pony").getElementsByTagName("input");
    var gpRegEx = /^G/;

    /* -- flick boxes on/off, depending upon what was passed -- */
    for (var t=0; t<boxes.length; t++)
    {
        /* -- check that they're only the "supergroup" boxes-- */
        if(gpRegEx.test(boxes[t].name))
        {
            boxes[t].checked = tick;
        }
    }
}

/* -- flick all checkboxes according to CheckAll box -- */
function buttonPressed()
{
    flickAllCheckboxes($("toggler").checked)
}

/* -- change "status" over -- */
function changeStatus()
{
    $("status").innerHTML = 'Processing...';
}

/* -- register button events -- */
function registerCheckBox()
{
    $("toggler").onclick = buttonPressed;
    $("start").onclick = changeStatus;
}

/* --- similar to BODY ONLOAD="" event registration --- */
if (window.addEventListener)
{
    window.addEventListener("load", registerCheckBox, false);
}
else if (window.attachEvent)
{
    window.attachEvent("onload", registerCheckBox);
}
