<?php 
$themeSettingConfig = $this->helper('MGS\ThemeSettings\Helper\Config');
$UseBackgroundName = $themeSettingConfig->getStoreConfig('themesettings/general/use_background_name');
$NameTheme = $themeSettingConfig->getStoreConfig('themesettings/general/name_theme');
?>
<?php if($UseBackgroundName) : ?>
<script type="text/javascript">
	require([
		'jquery',
	], function(jQuery){
		(function($) {
			$(document).ready(function(){
				$('.block > .block-title.title').addClass('background-name');
				<?php if($NameTheme) : ?>
					$( ".block > .block-title.background-name" ).append( '<span class="label-name sail-font"><?php echo $NameTheme; ?></span>' );
				<?php endif; ?>
			});	
		})(jQuery);
	});
</script>
<?php endif; ?>
<?php 
$bgrRelated = $themeSettingConfig->getStoreConfig('themesettings/product_details/background_color_related');
?>
<?php if($bgrRelated) : ?>
<script type="text/javascript">
	require([
		'jquery',
	], function(jQuery){
		(function($) {
			$(document).ready(function(){
				$('.catalog-product-view  .block.related').css("background-color", "<?php echo $bgrRelated ?>");
			});	
		})(jQuery);
	});
</script>
<?php endif; ?>
<?php 
$bgrContent = $themeSettingConfig->getStoreConfig('themesettings/product_details/background_of_content');
?>
<?php if($bgrContent) : ?>
<script type="text/javascript">
	require([
		'jquery',
	], function(jQuery){
		(function($) {
			$(document).ready(function(){
				$('.catalog-product-view  .page-main').css("background-color", "<?php echo $bgrContent ?>");
			});	
		})(jQuery);
	});
</script>
<?php endif; ?>
<script type="text/javascript" >
    require(
        [
            'jquery',
            'Magento_Ui/js/modal/modal'
        ],
        function(
            $,
            modal
        ) {
			
			$('.extra-link').click(function (){
                $('body').css({
                    "overflow-x": "hidden",
                });
                $("#extra-product-block").removeClass('js-form-hidden');
                $("#extra-product-block").addClass('js-form-active');
				var options = {
					type: 'popup',
					responsive: true,
                    innerScroll: true,
                    modalClass: 'extra-product-block',
                    closed: function() {
                        $("#extra-product-block").removeClass('js-form-active');
                        $("#extra-product-block").addClass('js-form-hidden');
                    }
				};

				var popup = modal(options, $('#extra-product-block'));

				$('#extra-product-block').modal('openModal');
				});
        }
    );
</script>

<!-- video popup -->
<script type="text/javascript" >
require([
	'jquery',
	'magnificPopup'
], function(jQuery){
	(function($) {
		$('.popup-video').magnificPopup({
			type: "iframe",
			mainClass: "mfp-video-about",
			preloader: false,
			fixedContentPos: false,
		});
	})(jQuery);
});
</script>
<script type="text/javascript">
	require([
		'jquery',
	], function(jQuery){
		(function($) {
			$(document).ready(function(){
				if($('.header-area').hasClass('header6')){
					$('body.cms-index-index').addClass('use-header6');
				}
			});	
		})(jQuery);
	});
</script>
