/**
  * Adds on client-side event handler by wrapping the code within a
  * javascript function block. If the code begins with "javascript:", the
  * code is assumed to be a javascript function block rather than arbiturary
  * javascript statements.
  * @param string option name
  * @param string javascript statements.
  */
 protected function setFunction($name, $code)
 {
     if (!TJavaScript::isFunction($code)) {
         $code = TJavaScript::quoteFunction($this->ensureFunction($code));
     }
     $this->setOption($name, $code);
 }