Form API, drupal_add_js() and setting a JS variable
I never tried, but I guess you can do it like that : 

$form['#attached']['js'] = array(
  array(
    'data' =&gt; drupal_get_path('module', 'radio86_media') . '/select_media.js',
    'type' =&gt; 'file'
  ),
  array(
    'data' =&gt; array('radio86_media' =&gt; array('barfoo' =&gt; 'booboo')),
    'type' =&gt; 'setting'
  )
);


According the documentation you should be able to add settings and files.