public function setMessage($message, $type = 'info', $global = false)
    {
        //if ajax send back the message
        //in the header
        if ($this->getRequest()->isAjax()) {
            $this->getResponse()
            ->setHeader('X-Message', json_encode(array(
                'text' => AnTranslator::_($message),
                'type' => $type
            )));
        } else {
            $this->storeValue('message', array('type' => $type, 'message' => $message), $global);
        }
    }