public function setAjax($ajax)
    {
        if (is_string($ajax)) {
            $pattern = '/^(\s+)*(function)(\s+)*\(/i';
            if (preg_match($pattern, $ajax, $matches) && strtolower($matches[2]) == 'function') {
                $hash = sha1($ajax);
                $this->properties['ajax'] = $hash;
                $this->callbacks[$hash] = $ajax;
                return $this;
            }

            $this->properties['ajax'] = $ajax;
            return $this;
        } else {
            $this->properties['ajax'] = $ajax;
            return $this;
        }
    }