How to get the image-URL from Media-Upload in a post?

I hate it to answer my own question.
But after hours of searching and trying I found a solution that works. I offer this solution, because it can’t be interesting for others having the same problem. And for discussion, if there is a better way to get rid of the problem. Perhaps it is not very elegant, but it works 😉

The peak is to change the click-event for the “Insert into Post”-Button in the ThickBox.

edit
Because the code worked only for ONE image in the library I had cto chnge the line in the click-function. Now it works with more then one picture

jQuery(document).ready(function() {
  //change click event for insert into post
  (function(){ 
var tb_show_temp = window.tb_show; 
window.tb_show = function() { 
  tb_show_temp.apply(null, arguments); 
  var iframe = jQuery('#TB_iframeContent');
  iframe.load(function() {
    var iframeDoc = iframe[0].contentWindow.document;
    var iframeJQuery = iframe[0].contentWindow.jQuery;
    var buttonContainer = iframeJQuery('td.savesend');
    if (buttonContainer) {
      var btnSubmit = jQuery('input:submit', buttonContainer);
      iframeJQuery(btnSubmit).click(function(){
        fldID = jQuery(this).attr('id').replace('send', '').replace('[', '').replace(']', '');
        var imgurl = iframeJQuery('input[name="attachments\\['+fldID+'\\]\\[url\\]"]').val();
        jQuery('#_meta_fotos\\[pic\\]').val(imgurl);
        jQuery('#picPreview').attr('src', imgurl);
        tb_remove();
      });
    }
  });
   }
  })()
//open uploader
jQuery('#_meta_fotos\\[pic\\]').focusin(function() {
formfield = jQuery('#_meta_fotos\\[pic\\]').attr('name');
tb_show('Use pictures', 'media-upload.php?type=image&tab=library&TB_iframe=1');
return false;
});
});