Nice! although I think you mean:
$to_include += $imgid + ','
because you don’t want any spaces in there at all.
Also, when you do another version of the plugin you might want to try to see if you can get it to leave off the last comma since I can see that causing a problem, although I haven’t seen one yet.
One other thing: I’ve noticed that the checkboxes don’t appear when the post editor is in HTML mode. Is that really the caes or am I crazy?