How to Programmatically add javascript dynamically from a custom module to modify a popup calendar property
You can attach a script to a form using the form's #attached attribute. You can do this in hook_form_alter as follows:

function hook_form_alter(&amp;$form, &amp;$form_state, $form_id)
{
  if($form_id == 'targeted_form')
  {
    $form['#attached']['js'][] = array
    (
      'type' =&gt; 'file',
      'data' =&gt; drupal_get_path('module', 'my_module') . '/scripts.js',
    );
  }
}


If you need to pass values from PHP to the form, you can attach values using Drupal.settings:

function hook_form_alter(&amp;$form, &amp;$form_state, $form_id)
{
  if($form_id == 'targeted_form')
  {
    $form['#attached']['js'][] = array
    (
      'type' =&gt; 'setting',
      'data' =&gt; array('myModule' =&gt; array('someSetting' =&gt; 'some value')),
    );
  }
}


Now the value will be available in your form at:

Drupal.settings.myModule.someSetting


Combine these two techniques to attach a form and pass it some settings.