function drop_receiving_element($element_id, $options = array())
{
    $obj =& get_instance();
    $obj->response->enqueue_js(array('prototype', 'builder', 'effects', 'dragdrop'));
    if (!isset($options['with'])) {
        $options['with'] = "'id=' + encodeURIComponent(element.id)";
    }
    if (!isset($options['onDrop'])) {
        $options['onDrop'] = "function(element){" . remote_function($options) . "}";
    }
    foreach (get_ajax_options() as $key) {
        unset($options[$key]);
    }
    if (isset($options['accept'])) {
        $options['accept'] = _array_or_string_for_javascript($options['accept']);
    }
    if (isset($options['hoverclass'])) {
        $options['hoverclass'] = "'{$options['hoverclass']}'";
    }
    return javascript_tag("Droppables.add('{$element_id}', " . _options_for_javascript($options) . ")");
}
/**
 * Makes the element with the DOM ID specified by '$element_id' receive
 * dropped draggable elements (created by 'draggable_element()') and make an AJAX call.
 * By default, the action called gets the DOM ID of the element as parameter.
 *
 * Example:
 *   <?php drop_receiving_element('my_cart', array(
 *      'url' => 'cart/add',
 *   )) ?>
 *
 * You can change the behaviour with various options, see
 * http://script.aculo.us for more documentation.
 */
function drop_receiving_element($element_id, $options = array())
{
    $response = sfContext::getInstance()->getResponse();
    $response->addJavascript(sfConfig::get('sf_prototype_web_dir') . '/js/prototype');
    $response->addJavascript(sfConfig::get('sf_prototype_web_dir') . '/js/builder');
    $response->addJavascript(sfConfig::get('sf_prototype_web_dir') . '/js/effects');
    $response->addJavascript(sfConfig::get('sf_prototype_web_dir') . '/js/dragdrop');
    if (!isset($options['with'])) {
        $options['with'] = "'id=' + encodeURIComponent(element.id)";
    }
    if (!isset($options['onDrop'])) {
        $options['onDrop'] = "function(element){" . remote_function($options) . "}";
    }
    foreach (get_ajax_options() as $key) {
        unset($options[$key]);
    }
    if (isset($options['accept'])) {
        $options['accept'] = array_or_string_for_javascript($options['accept']);
    }
    if (isset($options['hoverclass'])) {
        $options['hoverclass'] = "'{$options['hoverclass']}'";
    }
    return javascript_tag("Droppables.add('{$element_id}', " . options_for_javascript($options) . ")");
}