<?php
if (!isset($id) || !$id) {
    $id = "0";
}
$this->loadJavascript('/media/js/utils.js');
$this->loadJavascript('/media/js/prototype.js');
$this->loadJavascript('/media/js/colorpicker.js');
$this->loadJavascript('/media/js/slide_menu.js');
$this->loadJavascript('/media/js/pushup/js/pushup.js');
$this->loadCss('/media/js/pushup/css/pushup.css');
$this->loadCss('/media/css/base.css');
$this->loadCss('/media/css/loja.css');
$this->loadCss('/media/css/cms.css');
$this->loadCss('/media/css/utilizadores.css');
$this->loadCss('/media/css/slide_menu.css');
$session = Goweb::registry('session');
$this->headScript()->appendScript("var baseUrl = '" . $baseUrl . "';\n");
$this->headScript()->appendScript("var langSM = '" . $session->langCode . "';\n");
$config = Goweb::registry('config'); ?>
<?php echo $this->doctype() ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php $this->headMeta()->appendHttpEquiv('Content-Type',
                                   'text/html; charset=' . CHARSET)
                 ->appendHttpEquiv('Content-Language', $session->lang);
$this->headMeta()->appendHttpEquiv("X-UA-Compatible","IE=8");
$this->headTitle($config->painel->title);
if (isset($titulo) && $titulo == strip_tags($titulo)) $this->headTitle(html_entity_decode($titulo, ENT_NOQUOTES, CHARSET));
// separador
$this->headTitle()->setSeparator(' / ');
if ($config->painel->meta_copyright)
    $this->headMeta($config->painel->meta_copyright, 'copyright');
if ($config->painel->meta_keywords)
    $this->headMeta($config->painel->meta_keywords, 'keywords');
if (isset($keywords)) 
    $this->headMeta($keywords, 'keywords');
if ($config->painel->meta_description)
    $this->headMeta($config->painel->meta_description, 'description');

?>
<?php foreach ($this->getCss() as $css): ?>
<?php $this->headLink()->appendStylesheet($baseUrl . $css) ?>
<?php endforeach; ?>
<?php //$this->headLink()->appendStylesheet($baseUrl . $this->GetCssMinified()); ?>
<?php $this->headScript()->appendFile($baseUrl . '/media/js/go_admin.js')?>
<?php foreach ($this->getJavascripts() as $javascript): ?>
<?php $this->headScript()->appendFile($baseUrl . $javascript)?>
<?php endforeach; ?>
<?php //$this->headScript()->appendFile($baseUrl . $this->GetJavascriptsMinified()); ?>
<?php $this->headScript()->appendFile($baseUrl . '/media/js/AC_RunActiveContent.js')?>
<?php echo $this->headMeta() ?>
<?php foreach ($this->getRss() as $rss): ?>
<link rel="alternate" type="application/rss+xml" title="RSS" href="<?php echo $this->link($rss); ?>" />
<?php endforeach; ?>

<?php  if ($config->painel->meta_extra){
   echo $config->painel->meta_extra;
} ?>

<?php echo $this->headTitle() ?>
<?php echo $this->headLink() ?>
<?php echo $this->headScript() ?>

<!--[if IE]>
<script type="text/javascript" src="<?php echo $baseUrl?>/media/js/ie.js"></script>
<![endif]--> 
<!--[if lt IE 7]>
<script type="text/javascript" src="<?php echo $baseUrl?>/media/js/DD_belatedPNG_0.0.7a-min.js"></script>
<script type="text/javascript">
/* <![CDATA[ */
DD_belatedPNG.fix('img');
/* ]]> */
</script>
<![endif]--> 
<!--[if (gte IE 6)&(lte IE 8)]>
<script type="text/javascript" src="<?php echo $baseUrl?>/media/js/selectivizr/selectivizr.js"></script>
<![endif]-->
<?php echo $config->painel->google_analytics; ?>
</head>
<body>
<div id="container">
   <div id="header">
       <h1>Goweb</h1>
       <?php echo $this->component('/utilizadores/loginblock/'); ?>
   </div>
   
   <?php echo $this->component('/loja/mini_carrinho_qtd/'); ?>
   
   <div id="search_wrapper">
      <?php echo $this->component('/cms/pesquisa/'); ?>
   </div>
   <div id="menu">
      <?php echo $this->component('/cms/menu/pai_id/0/'); ?>
   </div>
   <div id="content">

         <h2><?php echo $titulo; ?></h2>
         <?php if (isset($error) && $error):?>
         <div id="messages">
            <div class="error"><?php echo $error; ?></div>
         </div>
         <?php endif; ?>
         <?php if (isset($message) && $message): ?>
         <div id="messages">
            <div class="message"><?php echo $message; ?></div>
         </div>
         <?php endif; ?>
         <?php echo $output ?>
         <br />
         <br />
   </div>
   <div id="footer"><strong>GoWeb</strong></div>
</div>
<?php // para adicionar css e/ou javascript chamados em componentes... ?>
<?php $javascripts = $this->getJavascripts(); ?>
<?php if (is_array($javascripts) && count($javascripts) > 0): ?>
<script type="text/javascript">
/* <![CDATA[ */
<?php foreach ($javascripts as $javascript): ?>
    loadjscssfile("<?php echo $baseUrl ?><?php echo $javascript ?>", "js");
<?php endforeach; ?>
/* ]]> */
</script>
<?php endif; ?>
<?php $css = $this->getCss(); ?>
<?php if (is_array($css) && count($css) > 0):  ?>
<script type="text/javascript">
/* <![CDATA[ */
<?php foreach ($css as $cssItem): ?>
loadjscssfile("<?php echo $baseUrl ?><?php echo $cssItem ?>", "css");
<?php endforeach; ?>
/* ]]> */
</script>
<?php endif;?>
</body>
</html>
