protected function _renderScripts()
    {
        $document = $this->getService('anahita:document');

        $string = '';
        $string .= $this->_template->getHelper('javascript')->language('lib_anahita');

        $scripts = array_reverse($document->getScripts());

        foreach ($scripts as $src => $script) {

            $type = $script['type'];

            $attribs = '';
            if (!empty($script['attribs'])) {
                $attribs = implode($script['attribs'], ' ');
            }

            $string .= '<script type="'.$type.'" src="'.$src.'" '.$attribs.'></script>';
        }

        $script = $document->getScript();

        foreach ($script as $type => $content) {
            $string .= '<script type="'.$type.'">'.$content.'</script>';
        }

        return $string;
    }