jQuery(document).ready(function() { jQuery(‘#upload_image_button’).click(function() { formfield = jQuery(‘#input1’).attr(‘name’); tb_show(”, ‘media-upload.php?type=image&TB_iframe=true’); return false; }); jQuery(‘#upload_texture_button’).click(function() { formfield = jQuery(‘#input2’).attr(‘name’); tb_show(”, ‘media-upload.php?type=image&TB_iframe=true’); return false; }); window.send_to_editor = function(html) { imgurl = jQuery(‘img’,html).attr(‘src’); jQuery(‘#’+formfield).val(imgurl); tb_remove(); } });