I think there are several options.
I read that PHP might work without the [] in the HTML.
All the message[] fields are not made into an array till after PHP processes the HTTP POST Request, which contains a string like the variables on the end of a URL (?var=value&another_variable=another_value)
Your message fields would look something like this:
?message[]=20&message[]=12&message[]=99&action=delete
PHP auto-magically splits them up and makes you a $_POST array of all these, and as a nice trick puts the ones ending in [] into an array (as you know).
But search the PHP web site and you'll find another global variable with the original string, which should contain all the form fields that were ticked regardless of the square-brackets[]. Examine this string with your own function and you don't need to use the [].
In other words a small extra bit of PHP should avoid re-working your Javascript/HTML.
Alternatively write a JavaScript function that finds the input elements a different way. For example give them all a class value <input class="group1" ...> then your functions get the array of all input elements and modifies any where class contains "group1" etc. something like:
Code:
function checkAll(group_name)
{
var inputs = getElementsByTagName("INPUT");
for (i = 0; i < inputs.length; i++)
if ( inputs[i].class.search(group_name) ) inputs[i].checked = true;
}