<?php

$hdw = new Hdw();

$content_after         = isset($content_after) ? $content_after : '';
$footer_top            = isset($footer_top) ? $footer_top : '';
$footer_content_top    = isset($footer_content_top) ? $footer_content_top : '';
$footer_content_bottom = isset($footer_content_bottom) ? $footer_content_bottom : '';
$footer_bottom         = isset($footer_bottom) ? $footer_bottom : '';
$tagbody_bottom        = isset($tagbody_bottom) ? $tagbody_bottom : '';

// $cod_total = $this->registry->get('config')->get('cod_total');

$iconsocial_html  = '';

if (isset($iconsocial_modules) && count($iconsocial_modules) > 0) {
	$iconsocial_title = isset($iconsocial_title) ? trim($iconsocial_title) : '';
	$iconsocial_style = isset($iconsocial_style) ? intval($iconsocial_style) : 1;

	if ($iconsocial_title != '') {
		$iconsocial_html .= '<h5>'. $iconsocial_title .'</h5>';
	}

	$iconsocial_html .= '<ul>';
	foreach ($iconsocial_modules as $iconsocial_module) {
		$iconsocial_html .= '<li>';
		$iconsocial_html .= '	<a href="'. $iconsocial_module['link'] .'" target="_blank" data-toggle="tooltip" title="'. $iconsocial_module['title'] .'">';
		$iconsocial_html .= '		<img src="'. $iconsocial_module['icon'] .'" />';
		$iconsocial_html .= '	</a>';
		$iconsocial_html .= '</li>';
	}
	$iconsocial_html .= '</ul>';

} else {
	$iconsocial_style = 0;
}

?>

	<?php if ($content_after != '') { ?>
		<div id="content-after" class="container">
			<div class="row">
				<?php echo $content_after; ?>
			</div>
		</div>
	<?php } ?>

</div>

<footer>
	<?php if ($footer_top != '') { ?>
		<div id="footer-top">
			<?php echo $footer_top; ?>
		</div>
	<?php } ?>

	<?php if ($footer_content_top != '') { ?>
		<div id="footer-content-top">
			<?php echo $footer_content_top; ?>
		</div>
	<?php } ?>

	<div id="footer-main">
		<div class="container">

			<div id="footer-main-content">

				<?php if ($iconsocial_style == 1) { ?>
					<div class="row">
						<div class="footer-menu col-xs-12 col-sm-9 col-md-10">
				<?php } ?>

				<div id="footer-menu" class="row">
					<?php if ($informations) { ?>
					<div class="footer-menu-column footer-menu-info col-xs-12 col-sm-3">
						<h5><?php echo $text_information; ?></h5>
						<ul class="list-unstyled">
							<?php foreach ($informations as $information) { ?>
							<li><a href="<?php echo $information['href']; ?>"><?php echo $information['title']; ?></a></li>
							<?php } ?>
						</ul>
					</div>
					<?php } ?>
					<div class="footer-menu-column footer-menu-service col-xs-12 col-sm-3">
						<h5><?php echo $text_service; ?></h5>
						<ul class="list-unstyled">
							<li class="footer-link-contact"><a href="<?php echo $contact; ?>"><?php echo $text_contact; ?></a></li>
							<li class="footer-link-return"><a href="<?php echo $return; ?>"><?php echo $text_return; ?></a></li>
							<li class="footer-link-sitemap"><a href="<?php echo $sitemap; ?>"><?php echo $text_sitemap; ?></a></li>
						</ul>
					</div>
					<div class="footer-menu-column footer-menu-extra col-xs-12 col-sm-3">
						<h5><?php echo $text_extra; ?></h5>
						<ul class="list-unstyled">
							<li class="footer-link-manufacturer"><a href="<?php echo $manufacturer; ?>"><?php echo $text_manufacturer; ?></a></li>
							<li class="footer-link-voucher"><a href="<?php echo $voucher; ?>"><?php echo $text_voucher; ?></a></li>
							<li class="footer-link-affiliate"><a href="<?php echo $affiliate; ?>"><?php echo $text_affiliate; ?></a></li>
							<li class="footer-link-special"><a href="<?php echo $special; ?>"><?php echo $text_special; ?></a></li>
						</ul>
					</div>
					<div class="footer-menu-column footer-menu-account col-xs-12 col-sm-3">
						<h5><?php echo $text_account; ?></h5>
						<ul class="list-unstyled">
							<li class="footer-link-account"><a href="<?php echo $account; ?>"><?php echo $text_account; ?></a></li>
							<li class="footer-link-order"><a href="<?php echo $order; ?>"><?php echo $text_order; ?></a></li>
							<li class="footer-link-wishlist"><a href="<?php echo $wishlist; ?>"><?php echo $text_wishlist; ?></a></li>
							<li class="footer-link-newsletter"><a href="<?php echo $newsletter; ?>"><?php echo $text_newsletter; ?></a></li>
						</ul>
					</div>
				</div>

				<?php if ($iconsocial_style == 1) { ?>
						</div>

						<div class="iconsocial iconsocial-column col-xs-12 col-sm-3 col-md-2">
							<?php echo $iconsocial_html; ?>
						</div>
					</div>
				<?php } ?>
				<?php if ($iconsocial_style == 2) { ?>
					<hr>

					<div class="row">
						<div class="iconsocial iconsocial-line col-xs-12">
							<?php echo $iconsocial_html; ?>
						</div>
					</div>
				<?php } ?>
			</div>

		</div>
	</div>

	<?php if ($footer_content_bottom != '') { ?>
		<div id="footer-content-bottom">
			<?php echo $footer_content_bottom; ?>
		</div>
	<?php } ?>

	<div id="footer-end">
		<div class="container">

			<div id="footer-end-content">
				<div class="powered"><?php echo $powered; ?></div>
			</div>

		</div>
	</div>

	<?php if ($footer_bottom != '') { ?>
		<div id="footer-bottom">
			<?php echo $footer_bottom; ?>
		</div>
	<?php } ?>
</footer>



<script>
var WebFontConfig = {
	// carrega arquivos locais em caso de falha dos CDNs
	fontinactive: function(familyName, fvd) {
		if (familyName == 'FontAwesome') {
			WebFont.load({
				custom: {
					families: [ 'FontAwesome' ],
					urls: ['<?php echo $hdw->_file_last_modified('catalog/view/javascript/font-awesome/css/font-awesome.min.css'); ?>'],
					testStrings: { 'FontAwesome': '\uf19d' }
				}
			});
		}
		if (familyName == 'Open Sans') {
			WebFont.load({
				custom: {
					families: [ 'Open+Sans:300,400,700,400i' ],
					urls: ['<?php echo $hdw->_file_last_modified('catalog/view/theme/hdw1/stylesheet/fonts.css'); ?>']
				}
			});
		}
	},

	classes: false,
	events: true,
	timeout: 2000,

	// tenta carregar os arquivos dos CDNs
	custom: {
		families: [ 'FontAwesome' ],
		urls: ['https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css'],
		testStrings: { 'FontAwesome': '\uf19d' }
	},
	google: {
		families: [ 'Open+Sans:300,400,700,400i' ]
	}
};

(function(){
	var wf = document.createElement("script");
	wf.src = '<?php echo $hdw->_file_last_modified('catalog/view/javascript/webfont.js'); ?>';
	wf.async = 'true';
	document.head.appendChild(wf);
})();
</script>



<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/pt_BR/sdk.js#xfbml=1&version=v2.4";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>



<?php echo $tagbody_bottom; ?>
</body></html>