<?php
	
	
	
	get_header(); deep_print_menu();
	$deep_thisPostID = get_the_ID(); 
	$woocommerce = deep_get_the_woo();
	$deep_color_code = get_option("deep_style_color");
	
	$type = get_option("deep_header_type_shop");
	$thecolor = deep_hex2rgb(str_replace("__USE_THEME_MAIN_COLOR__", $deep_color_code, get_option("deep_header_color_shop"))); 
	$opacity = intval(str_replace("%","",get_option("deep_header_opacity_shop")))/100;
	$color = "rgba(".$thecolor[0].",".$thecolor[1].",".$thecolor[2].",".$opacity.")";
	$image = get_option("deep_header_image_shop"); 
	$background_position = get_option("deep_header_background_shop_position");
	$pattern = is_array(get_option("deep_header_pattern_shop")) ? "":DEEP_PATTERNS_URL.get_option("deep_header_pattern_shop"); 
	$custompattern = get_option("deep_header_custom_pattern_shop"); 
	$margintop = get_option("deep_header_text_margin_top_shop");	
	$banner = get_option("deep_banner_slider_shop");
	$showtitle = get_option("deep_hide_pagetitle_shop") == "on" ? true : false;
	$showsectitle = get_option("deep_hide_sec_pagetitle_shop") == "on" ? true : false;
	$tcolor = str_replace("__USE_THEME_MAIN_COLOR__", $deep_color_code, get_option("deep_header_text_color_shop"));
	$tsize = intval(str_replace(" ", "", get_option("deep_header_text_size_shop")),10)."px";
	
	/* New 4.0 */
	$letterwoospacing = str_replace(" ", "", get_option("deep".'_header_woo_text_letterspacing'));
	$titlewoolineheight = get_option("deep".'_header_woo_text_lineheight');
	$titlewootransform = get_option("deep_header_woo_text_transform");
	
	$titlesecwooletterspacing = str_replace(" ", "", get_option("deep".'_secondary_title_woo_text_letterspacing'));
	$titlesecwoolineheight = get_option("deep".'_secondary_title_woo_text_lineheight');
	$titlesecwootransform = get_option("deep_secondary_title_woo_text_transform");
	
	$tfont = get_option("deep_header_text_font_shop");
	$stcolor = str_replace("__USE_THEME_MAIN_COLOR__", $deep_color_code, get_option("deep_secondary_title_text_color_shop"));
	$stsize = intval(str_replace(" ", "", get_option("deep_secondary_title_text_size_shop")),10)."px";
	$stfont = get_option("deep_secondary_title_font_shop");
	$stmargin = intval(str_replace(" ", "", get_option("deep_header_sec_text_margin_top_shop")),10)."px";
	$originalalign = get_option("deep_header_text_alignment_shop");
	$pt_parallax = get_option("deep_pagetitle_image_parallax_shop") == "on" ? true : false;
	$pt_overlay = get_option("deep_pagetitle_image_overlay_shop") == "on" ? true : false;
	$pt_overlay_type = get_option("deep_pagetitle_overlay_type_shop");
	$pt_overlay_the_color = deep_hex2rgb(str_replace("__USE_THEME_MAIN_COLOR__", $deep_color_code, get_option("deep_pagetitle_overlay_color_shop")));
	$pt_overlay_pattern = (is_string(get_option("deep_pagetitle_overlay_pattern_shop"))) ? DEEP_PATTERNS_URL.get_option("deep_pagetitle_overlay_pattern_shop") : "";
	$pt_overlay_opacity = intval(str_replace("%","",get_option("deep_pagetitle_overlay_opacity_shop")))/100;
	$pt_overlay_color = "rgba(".$pt_overlay_the_color[0].",".$pt_overlay_the_color[1].",".$pt_overlay_the_color[2].",".$pt_overlay_opacity.")";
	$breadcrumbs = get_option("deep_breadcrumbs_shop");
	$breadcrumbs_margintop = get_option('deep_breadcrumbs_text_margin_top_shop');
	$pagetitlepadding = get_option('deep_page_title_padding_shop');
	$height = "auto";

	$textalign = $originalalign;
	if ($originalalign == "titlesleftcrumbsright") $textalign = "left";
	if ($originalalign == "titlesrightcrumbsleft") $textalign = "right";
	
	
	$ultimate_smooth_scroll = get_option('ultimate_smooth_scroll');
	if($ultimate_smooth_scroll == "enable" || $ultimate_smooth_scroll === 'enable') {
		wp_enqueue_script('ultimate-vc-addons-smooth-scroll');
	}
	
	if (is_array($tfont)) $tfont = ""; $deep_import_fonts[] = $tfont;
	$principalfont = explode("|",$tfont);
	$principalfont[0] = $principalfont[0]."', 'Arial', 'sans-serif";
	if (!isset($principalfont[1])) $principalfont[1] = "";
		
	if (is_array($stfont)) $stfont = ""; $deep_import_fonts[] = $stfont;
	$secondaryfont = explode("|",$stfont);
	$secondaryfont[0] = $secondaryfont[0]."', 'Arial', 'sans-serif";
	if (!isset($secondaryfont[1])) $secondaryfont[1] = "";
		
	if ($type != "without"){
		
		$ptitleaux = $bcaux = "";
		if ($originalalign == "titlesleftcrumbsright" || $originalalign == "titlesrightcrumbsleft"){
    		$ptitleaux .= "max-width: 50%;";
    		$bcaux .= "max-width: 50%;";
    		if ($originalalign == "titlesleftcrumbsright"){
				$ptitleaux .= "float:left;";
				$bcaux .= "float:right;";
			} else {
				$ptitleaux .= "float:right;";
				$bcaux .= "float:left;";
			}
		}
		$bcaux .= "margin-top:".intval($breadcrumbs_margintop,10)."px;";
		switch($originalalign){
			case "left": case "titlesrightcrumbsleft":
				$bcaux .= "text-align: left;";
			break;
			case "right": case "titlesleftcrumbsright":
				$bcaux .= "text-align:right;";
			break;
			case "center": 
				$bcaux .= "text-align:center;";
			break;
		}
		?>
		<div class="fullwidth-container <?php if ($type == "pattern") echo "bg-pattern"; ?> <?php if ($pt_parallax) echo "parallax"; ?><?php if (($type == "image" || $type == "pattern") && get_option('deep_enable_grayscale') == 'on') echo " deep_grayscale "; if (get_option('deep_pagetitle_animations') == 'on') echo " wpb_animate_when_almost_visible wpb_fadeIn fadeIn";?>" <?php if ($pt_parallax) echo 'data-stellar-ratio="0.5"'; ?> 
	    	<?php
		    	$deep_output = ".fullwidth-container{";
		 		if ($height != "") $deep_output.= "height: ". $height . ";";
				if ($type == "none") $deep_output.= "background: none;"; 
				if ($type == "color") $deep_output.= "background: " . $color . ";";
				if ($type == "image") $deep_output.= "background: url(" . $image . ") no-repeat; background-size: 100% auto;";  
	 			if ($type == "pattern") $deep_output.= "background: url('" . $pattern . "') 0 0 repeat;";
				$deep_output .= "}";
				deep_set_custom_inline_css($deep_output);
				
				
	    	?> <?php if ($type == "image" && !$pt_parallax) echo ' data-background-alignment="'. esc_attr( $background_position ) .'" '; ?>>
	    	<?php
		    	if ($type == "image" && $pt_overlay){
			    	$deep_output = ".pagetitle_overlay{";
			    	echo '<div class="pagetitle_overlay"></div> '; 
			    	if ($pt_overlay_type == "color") $deep_output.= 'background-color:'.$pt_overlay_color.' !important';
			    	else $deep_output.= 'background:url('.$pt_overlay_pattern.') repeat;opacity:'.$pt_overlay_opacity.' !important;';
			    	$deep_output .= "}";
					deep_set_custom_inline_css($deep_output);
		    	}
		    	if ($type === "banner"){
			    	?> 
			    	<div class="revBanner">
				    	<?php
					    	if (substr($banner, 0, 10) === "revSlider_"){
								if (!function_exists('putRevSlider')){
									echo esc_html__('Please install the missing plugin - Revolution Slider.', 'deep');
								} else {
									putRevSlider(substr($banner, 10));
								}
							} 
							if (substr($banner, 0, 13) === "masterSlider_"){
								if (!function_exists('masterslider')){
									echo esc_html__('Please install the missing plugin - MasterSlider.', 'deep');
								} else {
									echo do_shortcode( '[masterslider alias="'.substr($banner, 13).'"]' );
								}
							}
							if (substr($banner, 0, 12) === "layerSlider_"){
								if (!function_exists('layerslider')){
									echo esc_html__('Please install the missing plugin - LayerSlider.', 'deep');
								} else {
									echo do_shortcode( '[layerslider id="'.substr($banner, 12).'"]' );
								}
							}
				    	?>
				    </div> 
				    <?php
		    	} else {
		    	?>
				<div class="container present-container <?php echo esc_attr($originalalign); if (get_option('deep_pagetitle_animations') == 'on') echo " wpb_animate_when_almost_visible wpb_fadeInUpnShort fadeInUpShort";?>">
					<?php
						$deep_output = ".present-container{padding: ".esc_attr($pagetitlepadding)." 15px;}";
						deep_set_custom_inline_css($deep_output);
					?>
					<div class="pageTitle">
					<?php
						$deep_output = ".present-container .pageTitle{text-align: ".esc_attr($textalign).";".esc_attr($ptitleaux)."}";
						deep_set_custom_inline_css($deep_output);
						if ($showtitle){
							?>
							<h1 class="page_title">
								
								<?php
									if ( is_product() || is_product_category() || is_product_tag() || is_shop() ){
						    		   echo esc_html(get_option("deep_shop_primary_title"));
					    		   	} else {
						    		   woocommerce_page_title();
					    		   	}
								?>
								
							</h1>
							<?php
							
							/* New 4.0 */	
							$deep_output = ".present-container h1.page_title{color: #$tcolor; font-size: $tsize; 
							
							letter-spacing: $letterwoospacing; line-height: $titlewoolineheight; text-transform: $titlewootransform;";
							
							if ($margintop != "") $deep_output .= esc_attr("margin-top: ".intval($margintop,10)."px;");
							
							if ($originalalign === "center") $deep_output .= esc_attr("text-indent: ".($letterwoospacing).";");
							
							
							$deep_output .= "}";
							deep_set_custom_inline_css($deep_output);
						}
		    			if ($showsectitle){
						    	?>
							    <h2 class="secondaryTitle">
								<?php
										if ( is_product() || is_product_category() || is_product_tag() ){
							    		   echo esc_html(get_option("deep_shop_secondary_title"));
						    		   	} else {
							    		  	echo esc_html(get_option("deep_shop_secondary_title"));
						    		   	}
									?>
							    </h2>
					    		<?php
						    	$deep_output = ".present-container .secondaryTitle{color: #$stcolor; font-size: $stsize; margin-top:{$stmargin};letter-spacing: $titlesecwooletterspacing; line-height: $titlesecwoolineheight; text-transform: $titlesecwootransform;}";
								deep_set_custom_inline_css($deep_output);
		    			}
		    		?>

		    		</div>
		    		<?php
		    		if ($breadcrumbs == "on"){
			    		?>
			    		<div class="deep_breadcrumbs" style="<?php echo esc_attr($bcaux); ?>">
							<?php deep_the_breadcrumb(); ?>
			    		</div>
			    		<?php
					}
					?>
					
				</div>
		<?php }
		?>
		</div>
		<?php
	}


	$sidebar_scheme = get_option('deep_woo_sidebar_scheme');
	$sidebar = deep_convert_to_class(get_option('deep_woo_sidebar'));
	switch ($sidebar_scheme){
		case "none":
			?>
			<div class="master_container master_container_bgwhite">
				<section class="page_content" id="section_page-<?php echo esc_attr($deep_thisPostID); ?>">
					<div class="container <?php if (get_option('deep_shop_animations') == 'on') echo " wpb_animate_when_almost_visible wpb_fadeInUpnShort fadeInUpShort"; ?><?php if (get_option("deep_shop_cols") == "two") echo " woo_two_cols"; ?><?php if (get_option("deep_shop_cols") == "three") echo " woo_three_cols"; ?><?php if (get_option("deep_shop_cols") == "four") echo " woo_four_cols"; ?>">
						<?php  woocommerce_content(); ?>
					</div>
				</section>
			</div>
			<?php
		break;
		case "left":
			?>
			<div class="master_container master_container_bgwhite <?php if (get_option('deep_shop_animations') == 'on') echo " wpb_animate_when_almost_visible wpb_fadeInUpnShort fadeInUpShort"; ?>">
				<div class="container">
					
					<?php if ( is_product() ){
						?>
						<section class="page_content col-xs-12 col-md-12<?php if (get_option("deep_shop_cols") == "two") echo " woo_two_cols"; ?><?php if (get_option("deep_shop_cols") == "three") echo " woo_three_cols"; ?><?php if (get_option("deep_shop_cols") == "four") echo " woo_four_cols"; ?>" id="section_page-<?php echo esc_attr($deep_thisPostID); ?>">
							<?php  woocommerce_content(); ?>
						</section>
						<?php 
					 }
					else{
					
					?>
					<section class="page_content left sidebar col-xs-12 col-md-3">
						<?php 
						if ( !is_product() ){
						if ($sidebar === "defaultblogsidebar") $sidebar = 'sidebar-widgets';
						if ( function_exists('dynamic_sidebar') && is_active_sidebar( $sidebar )) { 
							ob_start();
							do_shortcode(dynamic_sidebar($sidebar));
							$html = ob_get_contents();
							ob_end_clean();
							$html = wp_kses_no_null( $html, array( 'slash_zero' => 'keep' ) );
							$html = wp_kses_normalize_entities($html);
							echo wp_kses_hook($html, 'post', array());  
						} else get_sidebar();
					}
						?>
					</section>
					<section class="page_content right col-xs-12 col-md-9<?php if (get_option("deep_shop_cols") == "two") echo " woo_two_cols"; ?><?php if (get_option("deep_shop_cols") == "three") echo " woo_three_cols"; ?><?php if (get_option("deep_shop_cols") == "four") echo " woo_four_cols"; ?>" id="section_page-<?php echo esc_attr($deep_thisPostID); ?>">
						<?php  woocommerce_content(); ?>
					</section>
					<?php
					}
					?>
				</div>
			</div>
			<?php
		break;
		case "right":
			?>
			<div class="master_container master_container_bgwhite <?php if (get_option('deep_shop_animations') == 'on') echo " wpb_animate_when_almost_visible wpb_fadeInUpnShort fadeInUpShort"; ?>">
				<div class="container">
					
					<?php if ( is_product() ){
						?>
						<section class="page_content col-xs-12 col-md-12<?php if (get_option("deep_shop_cols") == "two") echo " woo_two_cols"; ?><?php if (get_option("deep_shop_cols") == "three") echo " woo_three_cols"; ?><?php if (get_option("deep_shop_cols") == "four") echo " woo_four_cols"; ?>" id="section_page-<?php echo esc_attr($deep_thisPostID); ?>">
							<?php  woocommerce_content(); ?>
						</section>
						<?php 
					 }
					else{
					
					?>

					<section class="page_content left col-xs-12 col-md-9<?php if (get_option("deep_shop_cols") == "two") echo " woo_two_cols"; ?><?php if (get_option("deep_shop_cols") == "three") echo " woo_three_cols"; ?><?php if (get_option("deep_shop_cols") == "four") echo " woo_four_cols"; ?>" id="section_page-<?php echo esc_attr($deep_thisPostID); ?>">
						<?php  woocommerce_content(); ?>
					</section>
					
					<section class="page_content right sidebar col-xs-12 col-md-3">
						<?php 
						
						if ($sidebar === "defaultblogsidebar") $sidebar = 'sidebar-widgets';
						if ( function_exists('dynamic_sidebar') && is_active_sidebar( $sidebar )) { 
							ob_start();
							do_shortcode(dynamic_sidebar($sidebar));
							$html = ob_get_contents();
							ob_end_clean();
							$html = wp_kses_no_null( $html, array( 'slash_zero' => 'keep' ) );
							$html = wp_kses_normalize_entities($html);
							echo wp_kses_hook($html, 'post', array());  
						} else get_sidebar();
					
						?>
					</section>
					<?php
					}
					?>
					
				</div>
			</div>
			<?php
		break;
		default:
			?>
			<div class="master_container master_container_bgwhite">
				<section class="page_content" id="section_page-<?php echo esc_attr($deep_thisPostID); ?>">
					<div class="container">
					<?php woocommerce_content(); ?>
					</div>
				</section>
			</div>
			<?php
		break;
	}

		
get_footer(); ?>