don’t know if you found the answer but i’ll post anyway.
window.send_to_editor = function(html) {
imgurl = jQuery('a',html).attr('href');
jQuery(upload_id).val(imgurl);
tb_remove();
}
becomes
window.send_to_editor = function(html) {
imgurl = jQuery(html).attr('href');
jQuery(upload_id).val(imgurl);
tb_remove();
}
and if you need it for the images also, your can do a jquery check on html to see if it has <img> tag or not and change the imgurl based on that