function _tag_options($options = array(), $raw = false)
{
  static $sf_incremental_id = 0;
  $options = _parse_attributes($options);
  $response = sfContext::getInstance()->getResponse();
  $script = $response->getParameter('script', '', 'symfony/view/UJS');
  $html = '';
  $id = isset($options['id']) ? $options['id'] : false;
  foreach ($options as $key => $value)
  {
    if(strpos($key, 'on') !== 0 || $raw)
    {
      // regular attribute
      $html .= ' '.$key.'="'.escape_once($value).'"';
    }
    else
    {
      // event handler
      if(!$id)
      {
        $id = UJS_incremental_id();
        $html .= ' id="'.$id.'"';
      }
      use_javascript('/sfUJSPlugin/js/jquery');
      if(is_array($value))
      {
        $behaviour = array();
        foreach($value as $behaviour_single)
        {
          $behaviour[] = "function() { ".escape_once($behaviour_single)." }";
        }
        $behaviour = implode(' ,', $behaviour);
      }
      else
      {
        $behaviour = "function() { ".escape_once($value)." }";
      }
      $script .= "$('#".$id."').".
                     substr($key, 2, strlen($key) - 2).
                     "( ".$behaviour." );\n";
    }
    $response->setParameter('script', $script, 'symfony/view/UJS');
  }

  return $html;
}
/**
 * Adds some some content unobstrusively
 *
 * <b>Example:</b>
 * <code>
 *  <?php UJS_write('<div>Hello, world!</div>') ?>
 * </code>
 *
 * @param string the HTML content to use for insertion
 *
 */
function UJS_write($html)
{
  $id = UJS_incremental_id();
  UJS_replace("#".$id, $html);
  echo UJS_placeholder($id);
}