Select all check box

hi,

i need a check box to placed on the header .When i select all checkboxs in the column should be checked.How to handle this .

mygrid.attachEvent(“onCheck”,function(){
document.getElementById(“some_checkbox”).checked = (this.getCheckedRows(ind).split(",").length == this.getRowsNum());
return true;
})

Where ind - index of column with checkboxes ( zero-based )