<?php 
/******************************************************
 * @package Pav Opencart Theme Framework for Opencart 1.5.x
 * @version 1.0
 * @author http://www.pavothemes.com
 * @copyright	Copyright (C) Feb 2013 PavoThemes.com <@emai:pavothemes@gmail.com>.All rights reserved.
 * @license		GNU General Public License version 2
*******************************************************/
	$themeConfig = $this->config->get( 'themecontrol' );
	$themeName =  $this->config->get('config_template');
	require_once( DIR_TEMPLATE.$this->config->get('config_template')."/template/libs/module.php" );
	$helper = ThemeControlHelper::getInstance( $this->registry, $themeName );

	/* Add scripts files */
	$helper->addScript( 'catalog/view/javascript/jquery/jquery-1.7.1.min.js' );
	$helper->addScript( 'catalog/view/javascript/jquery/ui/jquery-ui-1.8.16.custom.min.js' );
	$helper->addScript( 'catalog/view/javascript/jquery/ui/external/jquery.cookie.js' );
	$helper->addScript( 'catalog/view/javascript/common.js' );
	$helper->addScript( 'catalog/view/theme/'.$themeName.'/javascript/common.js' );
	$helper->addScript( 'catalog/view/javascript/jquery/bootstrap/bootstrap.min.js' );

?>
<!DOCTYPE html>
<html dir="<?php echo $direction; ?>" lang="<?php echo $lang; ?>">
<head>
<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame -->
 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<!-- Mobile viewport optimized: h5bp.com/viewport -->
<meta name="viewport" content="width=device-width">
<meta charset="UTF-8" />
<title><?php echo $title; ?></title>
<base href="<?php echo $base; ?>" />
<?php if ($description) { ?>
<meta name="description" content="<?php echo $description; ?>" />
<?php } ?>
<?php if ($keywords) { ?>
<meta name="keywords" content="<?php echo $keywords; ?>" />
<?php } ?>
<?php if ($icon) { ?>
<link href="<?php echo $icon; ?>" rel="icon" />
<?php } ?>
<?php foreach ($links as $link) { ?>
<link href="<?php echo $link['href']; ?>" rel="<?php echo $link['rel']; ?>" />
<?php } ?>
<link rel="stylesheet" type="text/css" href="catalog/view/theme/<?php echo $themeName;?>/stylesheet/bootstrap.css"/>
<link rel="stylesheet" type="text/css" href="catalog/view/theme/<?php echo $themeName;?>/stylesheet/stylesheet.css"/>
<link rel="stylesheet" type="text/css" href="catalog/view/theme/<?php echo $themeName;?>/stylesheet/icons-header.css"/>
<style>
	<?php if( $themeConfig['theme_width'] &&  $themeConfig['theme_width'] != 'auto' ) { ?>
			#page-container .container{max-width:<?php echo $themeConfig['theme_width'];?>; width:auto}
	<?php } ?>
	
	<?php if( isset($themeConfig['use_custombg']) && $themeConfig['use_custombg'] ) {	?>
		body{
			background:url( "image/<?php echo $themeConfig['bg_image'];?>") <?php echo $themeConfig['bg_repeat'];?>  <?php echo $themeConfig['bg_position'];?> !important;
		}
	<?php } ?>
	<?php 
		if( isset($themeConfig['custom_css'])  && !empty($themeConfig['custom_css']) ){
			echo trim( html_entity_decode($themeConfig['custom_css']) );
		}
	?>
</style>
<?php 
	if( isset($themeConfig['enable_customfont']) && $themeConfig['enable_customfont'] ){
	$css=array();
	$link = array();
	for( $i=1; $i<=3; $i++ ){
		if( trim($themeConfig['google_url'.$i]) && $themeConfig['type_fonts'.$i] == 'google' ){
			$link[] = '<link rel="stylesheet" type="text/css" href="'.trim($themeConfig['google_url'.$i]) .'"/>';
			$themeConfig['normal_fonts'.$i] = $themeConfig['google_family'.$i];
		}
		if( trim($themeConfig['body_selector'.$i]) && trim($themeConfig['normal_fonts'.$i]) ){
			$css[]= trim($themeConfig['body_selector'.$i])." {font-family:".str_replace("'",'"',htmlspecialchars_decode(trim($themeConfig['normal_fonts'.$i])))."}\r\n"	;
		}
	}
	echo implode( "\r\n",$link );
?>
<style>
	<?php echo implode("\r\n",$css);?>
</style>

<?php } else { ?>
<link rel="stylesheet" type="text/css" href="catalog/view/theme/<?php echo $themeName;?>/stylesheet/font.css" />
<?php } ?>
<?php foreach ($styles as $style) { ?>
<link rel="<?php echo $style['rel']; ?>" type="text/css" href="<?php echo $style['href']; ?>" media="<?php echo $style['media']; ?>" />
<?php } ?>
<link rel="stylesheet" type="text/css" href="catalog/view/javascript/jquery/ui/themes/ui-lightness/jquery-ui-1.8.16.custom.css" />
<?php if( $helper->getParam('skin') &&  $helper->getParam('skin') != 'default' ){ ?>
<link rel="stylesheet" type="text/css" href="catalog/view/theme/<?php echo $themeName;?>/skins/<?php echo  $helper->getParam('skin');?>/stylesheet/stylesheet.css" />
<?php } ?>
<link rel="stylesheet" type="text/css" href="catalog/view/theme/<?php echo $themeName;?>/stylesheet/font-awesome.min.css" />
<?php if( isset($themeConfig['responsive']) && $themeConfig['responsive'] ){ ?>
<link rel="stylesheet" type="text/css" href="catalog/view/theme/<?php echo $themeName;?>/stylesheet/bootstrap-responsive.css" />
<link rel="stylesheet" type="text/css" href="catalog/view/theme/<?php echo $themeName;?>/stylesheet/theme-responsive.css" />
<?php } ?>
<?php if( $direction == 'rtl' ) { ?>
<link rel="stylesheet" type="text/css" href="catalog/view/theme/<?php echo $themeName;?>/stylesheet/bootstrap-rtl.css" />
<link rel="stylesheet" type="text/css" href="catalog/view/theme/<?php echo $themeName;?>/stylesheet/theme-rtl.css" />
<?php } ?>

<?php foreach( $helper->getScriptFiles() as $script )  { ?>
<script type="text/javascript" src="<?php echo $script; ?>"></script>
<?php } ?>

<?php foreach ($scripts as $script) { ?>
<script type="text/javascript" src="<?php echo $script; ?>"></script>
<?php } ?>

<?php if( isset($themeConfig['custom_javascript'])  && !empty($themeConfig['custom_javascript']) ){ ?>
	<script type="text/javascript"><!--
		$(document).ready(function() {
			<?php echo html_entity_decode(trim( $themeConfig['custom_javascript']) ); ?>
		});
//--></script>
<?php }	?>
<!--[if IE 8]>         
 <link rel="stylesheet" type="text/css" href="catalog/view/theme/<?php echo $themeName;?>/stylesheet/ie8.css" />
<![endif]-->
<!--[if lt IE 9]>
<?php if( isset($themeConfig['load_live_html5'])  && $themeConfig['load_live_html5'] ) { ?>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<?php } else { ?>
<script src="catalog/view/javascript/html5.js"></script>
<?php } ?>
<![endif]-->

<?php if ( isset($stores) && $stores ) { ?>
<script type="text/javascript"><!--
$(document).ready(function() {
<?php foreach ($stores as $store) { ?>
$('body').prepend('<iframe src="<?php echo $store; ?>" style="display: none;"></iframe>');
<?php } ?>
});
//--></script>
<?php } ?>
<?php echo $google_analytics; ?>
</head>
<body class="fs<?php echo $themeConfig['fontsize'];?> <?php echo $helper->getPageClass();?> <?php echo $helper->getParam('body_pattern','pattern2');?>">
	<div id="page-container">
	<header id="header">
	<div id="headertop">
		<div class="container">
			<div class="container-inner">
			<div class="hidden-tablet hidden-phone">
					<div class="pull-left">
						<span class="currency ">
							<?php echo $currency; ?>
						</span> 
						<span class="language">
							<?php echo $language; ?>
						</span> 
					</div>
					<div class="pull-right">
						<div class="login pull-right">
								<?php if (!$logged) { ?>
								<?php echo $text_welcome; ?>
								<?php } else { ?>
								<?php echo $text_logged; ?>
								<?php } ?> 
						</div>
						
						<div class="links  pull-right">
							<!--<a class="first" href="<?php //echo $home; ?>"><?php // echo $text_home; ?></a>-->
							<a class="account" href="<?php echo $account; ?>"><?php echo $text_account; ?></a>
							<a class="wishlist" href="<?php echo $wishlist; ?>" id="wishlist-total"><?php echo $text_wishlist; ?></a>
							<!--<a href="<?php //echo $shopping_cart; ?>"><?php //echo $text_shopping_cart; ?></a>-->
							<a class="last checkout" href="<?php echo $checkout; ?>"><?php echo $text_checkout; ?></a>
							
						</div>
					</div>
				</div>	
					
				
					
			<div class="show-mobile hidden-desktop  pull-right">
				<div class="quick-user pull-left">
							<div class="quickaccess-toggle">
								<i class="fa fa-user"></i>															
							</div>	
							<div class="inner-toggle">
								<div class="login links">
									<?php if (!$logged) { ?>
									<span><?php echo $text_welcome; ?></span>
									<?php } else { ?>
									<span><?php echo $text_logged; ?></span>
									<?php } ?> 
								</div>
							</div>						
						</div>
						<div class="quick-access pull-left">
							<div class="quickaccess-toggle">
								<i class="fa fa-list"></i>															
							</div>	
							<div class="inner-toggle">
								<ul class="links pull-left">
									<!-- <li><a class="first" href="<?php echo $home; ?>"><?php echo $text_home; ?></a></li> -->
									<li><a class="account" href="<?php echo $account; ?>"><?php echo $text_account; ?></a></li>
									<li><a class="wishlist" href="<?php echo $wishlist; ?>" id="wishlist-total"><?php echo $text_wishlist; ?></a></li>
									<li><a class="shoppingcart" href="<?php echo $shopping_cart; ?>"><?php echo $text_shopping_cart; ?></a></li>
									<li><a class="last checkout" href="<?php echo $checkout; ?>"><?php echo $text_checkout; ?></a></li> 
						
								</ul>
							</div>						
						</div>


						<div id="search_mobile" class="search pull-left">				
							<div class="quickaccess-toggle">
								<i class="fa fa-search"></i>								
							</div>																								
							<div class="inner-toggle">
							
							<div id="search">
						<input type="text" name="search1" placeholder="<?php echo $text_search; ?>" value="<?php echo $search; ?>" />
							<span class="button-search">Search</span>
					</div>
								

							</div>
						</div>


						<div class="currency-mobile pull-left">
							<div class="quickaccess-toggle">
								<i class="fa fa-calendar"></i>								
							</div>						
							<div class="inner-toggle">
								<div class="currency pull-left">
									<?php echo $currency; ?>
								</div> 
							</div>															
						</div>
						
						
						<div class="language-mobile pull-left">
							<div class="quickaccess-toggle">
								<i class="fa fa-sun-o"></i>								
							</div>						
							<div class="inner-toggle">	
								<div class="language pull-left">
									<?php echo $language; ?>
								</div>
							</div>															
						</div>
						
			</div>	
			</div>
		</div>
	</div>
	<div id="headerbottom">
		<div class="container">
		<div class="container-inner">
					  <?php if ($logo) { ?>
					  <div id="logo"><a href="<?php echo $home; ?>"><img src="<?php echo $logo; ?>" title="<?php echo $name; ?>" alt="<?php echo $name; ?>" /></a></div>
					  <?php } ?>
					  <div id="top-blocks-base">
						
						<div class="top-blocks">
						
						<div class="icon"><img src="catalog/view/theme/pav_decor/image/contato-futura.png" width="48" height="47"></div>
						<div class="icon-desc"><b>Contato</b>
						<?php if ($telephone) { ?>
						<br>Fone: <?php echo $telephone; ?>
						<?php } ?>
						<?php if ($fax) { ?>
						<br>Fax:  <?php echo $fax; ?>
						<?php } ?>
		        		<?php if(($text_email)&&($this->config->get('config_futura_seo_email'))&&(($this->config->get('config_futura_seo_exibe_email')!=2))) {
                		 foreach(explode(';',$text_email) as $value){
        		        ?>
        				Email:<?php echo $value; ?><br>
        				<?php 	
        		         }				
        		        }
        		       ?>						
						</div>
					  </div>
				<div class="search-cart hidden-phone pull-right">
					<?php echo $cart; ?>
					<div id="search" class="btn hidden-tablet">
						<a class="search-icon" href="#">search</a>
						<div class="search-content">
						<div class="search-content-inner">
							<input type="text" name="search" placeholder="<?php echo $text_search; ?>" value="<?php echo $search; ?>" style="height: 26px; line-height: 22px; background: #fff; border: 1px solid #dcdcdc; box-shadow: none; border-radius: 0; padding: 4px 5px 5px; margin-left: 0px; margin-right: 0px; width:70%;" />
							<span class="button-search">Buscar</span>
						</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</header>
		<div id="mainnav">
			<div class="container">
				<div class="mainnav-inner">
					<div class="row-fluid">
																		
						<!--<div id='box-pesquisar'>
						
						<input type="text" name="searchmenu" placeholder="Buscar" value="Buscar" class="txt" />

						<input type="submit" class="button-searchmenu botao-pesquisar" value="Buscar">												
																											
						</div>-->
						
						<div id='box-pesquisar'>
						
						<input type="text" name="searchmenu" placeholder="<?php echo $text_search; ?>" value="<?php echo $search; ?>" class="txt" />
							
						<input type="submit" class="button-searchmenu botao-pesquisar" value="Buscar">
															
						</div>

					</div>
				</div>
			</div>
		</div>
		<?php
		/**
		 * Slideshow modules
		 */
		
		$modules = $helper->getModulesByPosition( 'slideshow' );
		$ospans = array();

		if( count($modules) ){
		$cols = isset($config['block_slideshow'])&& $config['block_slideshow']?(int)$config['block_slideshow']:count($modules);
		$class = $helper->calculateSpans( $ospans, $cols );
		?>
		<section id="slideshow" class="pav-slideshow hidden-phone">
			<?php if( count($modules) == 1 ) { ?>
				<?php echo $modules[0]; ?>
			<?php } else { ?>
				<?php $j=1;foreach ($modules as $i =>  $module) {   ?>
				<?php if(  $i++%$cols == 0 || count($modules)==1 ){  $j=1;?><div class="row-fluid"><?php } ?>	
				<div class="<?php echo $class[$j];?>"><?php echo $module; ?></div>
				<?php if( $i%$cols == 0 || $i==count($modules) ){ ?></div><?php } ?>	
				<?php  $j++;  } ?>
			<?php } ?>
		</section>
		<?php } ?>

	<?php
/**
 * Promotion modules
 * $ospans allow overrides width of columns base on thiers indexs. format array( column-index=>span number ), example array( 1=> 3 )[value from 1->12]
 */
$modules = $helper->getModulesByPosition( 'showcase' ); 
$ospans = array();
$cols   = 1;
if( count($modules) ){?>
<section class="pav-showcase" id="pavo-showcase">
			<div class="container">
				<?php $j=1;foreach ($modules as $i =>  $module) {   ?>
			<?php if( $i++%$cols == 0 || count($modules)==1 ){  $j=1;?><div class="row-fluid"><?php } ?>	
			<div class="span<?php echo floor(12/$cols);?>"><?php echo $module; ?></div>
			<?php if( $i%$cols == 0 || $i==count($modules) ){ ?></div><?php } ?>	
		<?php  $j++;  } ?>
			</div>
		</section>
<?php } ?>

		<?php
		/**
		 * Promotion modules
		 * $ospans allow overrides width of columns base on thiers indexs. format array( 1=> 3 )[value from 1->12]
		 */
		$modules = $helper->getModulesByPosition( 'promotion' );
		$ospans = array();

		if( count($modules) ){
		$cols = isset($config['block_promotion'])&& $config['block_promotion']?(int)$config['block_promotion']:count($modules);	
		$class = $helper->calculateSpans( $ospans, $cols );
		?>
		<section class="pav-promotion" id="pav-promotion">
			<div class="container">
				<?php $j=1;foreach ($modules as $i =>  $module) {   ?>
			<?php if( $i++%$cols == 0 || count($modules)==1 ){  $j=1;?><div class="row-fluid"><?php } ?>	
			<div class="<?php echo $class[$j];?>"><?php echo $module; ?></div>
			<?php if( $i%$cols == 0 || $i==count($modules) ){ ?></div><?php } ?>	
		<?php  $j++;  } ?>
			</div>
		</section>
		<?php } ?>
	<div id="sys-notification"><div class="container"><div id="notification"></div></div></div>
	<section id="columns"><div class="container"><div class="row-fluid">
		
		