check and uncheck the all checkbox using javascript

/**
pass the checkbox_name array
**/
function checkAll(form_object, checkbox_name)
{
for(var i=0; i < form_object[checkbox_name].length; i++)
{
form_object[checkbox_name][i].checked = true;
}
}

function uncheckAll(form_object, checkbox_name)
{
for(var i=0; i < form_object[checkbox_name].length; i++){

form_object[checkbox_name][i].checked = false;

}
}