var farbe = '000000';

function alterColor(index)
{
    with (document) {
        getElementById('px'+index).style.backgroundColor = '#'+farbe;
        getElementById('pixel'+index).value = farbe;
    }
}

function swapColor(index, mode)
{
    with (document) {
        if (mode == 'over')
            getElementById('px'+index).style.backgroundColor = '#' + farbe;
        else if (mode == 'out')
            getElementById('px'+index).style.backgroundColor = '#' + document.getElementById('pixel'+index).value;
    }
}

function clearValues()
{
    with (document) {
        for (i = 1; i <= 1024; i++) {
            getElementById('px'+i).style.backgroundColor = '#FFFFFF';
            getElementById('pixel'+i).value = 'FFFFFF';
        }
        getElementById('nick').value = '';
        getElementById('message').value = '';
    }
    farbe = '000000';
}

function swapGrid()
{
    with (document.getElementById('malbox')) {
        if (cellPadding == '1') {
            cellPadding = '0';
            cellSpacing = '0';
            document.getElementById('grid').value = 'Raster ein';
        } else {
            cellPadding = '1';
            cellSpacing = '1';
            document.getElementById('grid').value = 'Raster aus';
        }
    }
}
