function inCell(cell, newcolor) {
    if (!cell.contains(event.fromElement)) {
        cell.color = newcolor;
    }
}

function outCell(cell, newcolor) {
    if (!cell.contains(event.toElement)) {
        cell.color = newcolor;
    }
}