<?php
$output = $el_class = '';
extract(shortcode_atts(array(
	'el_class' => '',
	'row_type' => 'main-section',
	'bauen_section_id' => '',
	'bauen_section_class' => '',
	'bauen_section_layout' => '',
	'bauen_section_layout_grid' => '',	
	'bauen_section_row_grid' => '',	
	'bauen_section_height' => '',
	'bauen_background_img' => '',
	'bauen_background_color' => '',
	'bauen_color_scheme' => '',
	'bauen_background_parallax' => '',
	'bauen_background_parallaxx' => '',
	'bauen_background_overly' => '3',
	'bauen_padding_top' => '',
	'bauen_padding_bottom' => '',
	'bauen_margin_top' => '',
	'bauen_margin_bottom' => '',
	'bauen_separator' => '',	
	'bauen_df_padding_top' => '',	
	'bauen_df_padding_bottom' => '',				

), $atts));

wp_enqueue_style( 'js_composer_front' );
wp_enqueue_script( 'wpb_composer_front_js' );
wp_enqueue_style('js_composer_custom_css');

// separator
if ($bauen_separator == "st2"){
   $bauen_section_separator ='';
} else {
   $bauen_section_separator ='<div class="sec-dec"></div>';
}

$bauen_back_image ="";
if($bauen_background_img != '' || $bauen_background_img != ' ') { 
	$bauen_back_image = wp_get_attachment_image_src( $bauen_background_img, 'full');
}

$bauen_class_layout_full =  "";
$bauen_row_layout_full =  "";
$bauen_class_layout_grid =  "";
$bauen_row_layout_grid =  "";
if($bauen_section_layout == "section_grid"){
	if($bauen_section_layout_grid == "section_layout_grid"){
	$bauen_class_layout_grid =  "container-fluid";
	} else if($bauen_section_layout_grid == "section_layout_grid2"){
	$bauen_class_layout_grid =  "container-fluid";
	} else if($bauen_section_layout_grid == "section_layout_grid3"){
	$bauen_class_layout_grid =  "container-wide";
	} else {
	$bauen_class_layout_grid =  "container";	
	}	
	if($bauen_section_row_grid == "no"){
	$bauen_row_layout_grid =  "row-off";		
	} else {	
	$bauen_row_layout_grid =  "row";	
	}
}
else {
	$bauen_class_layout_full =  "wr-section-full-width";
	$bauen_row_layout_full =  "row-off";	
}


//blank row
if($row_type == 'st1'){
    $output .='<div class="clear"></div>';
    $output .='<div class="blank-section">';
	
}
// main row
else if($row_type == 'main-section'){

$output .='<div class="clear"></div>';
$output .='<section';
if($bauen_section_id != ""){
$output .=' id="'.$bauen_section_id.'"';
}
$output .=' class="full-width-section '.$bauen_class_layout_full.' '.$bauen_color_scheme.' '.$bauen_section_class.' "';
$output.='>';	

    $output .='<div class="block-wrapper '.$bauen_df_padding_top.' '.$bauen_df_padding_bottom.' ';	
	    if($bauen_background_img != ""){ 
		if($bauen_background_parallaxx == "st1"){			
		$output.='background bg-img bg-fixed';	
		}	
		}
    $output .='"';	
	    if($bauen_background_img != ""){ 
		if($bauen_background_parallaxx == "st1"){			
		$output.=' data-background="'.$bauen_back_image[0].'" data-overlay-dark="'.$bauen_background_overly.'"';	
		}
		}
		
	if($bauen_background_color != "" || $bauen_background_img != "" || $bauen_padding_top != "" || $bauen_padding_bottom != "" || $bauen_margin_top != "" || $bauen_margin_bottom != ""){
			$output .= " style='";		
				if($bauen_background_color != ""){
					$output .="background-color:".$bauen_background_color.";";
				}	
				if($bauen_background_parallaxx != "st1"){
					if($bauen_background_img != ""){ 
					$output .="background: url(".$bauen_back_image[0].");";
					}
				}				
				if($bauen_padding_top != ""){
					$output .=" padding-top:".$bauen_padding_top.";";
				}
				if($bauen_padding_bottom != ""){
					$output .=" padding-bottom:".$bauen_padding_bottom.";";
				}
				if($bauen_margin_top != ""){
					$output .=" margin-top:".$bauen_margin_top.";";
				}
				if($bauen_margin_bottom != ""){
					$output .=" margin-bottom:".$bauen_margin_bottom.";";
				}				
				$output.="'";
		}		
	$output.=">";
		$output .='<div class="section-wrapper '.$bauen_class_layout_grid.' ">';		
		$output .='<div class="row-layout '.$bauen_row_layout_full.' '.$bauen_row_layout_grid.' ">';

}

//blank row by default
else {
$output .='<div class="clear"></div>';
$output .='<div class="blank-section">';	
}

if($row_type != 'content_menu'){
	$output .= wpb_js_remove_wpautop($content);
}
//blank row
if($row_type == 'st1'){
	$output .= '</div><div class="clear"></div>'.$this->endBlockComment('row');
}
// main row
else if($row_type == 'main-section'){
$output .= '</div></div></div></section><div class="clear"></div>'.$this->endBlockComment('row');
}
//blank row by default
else {
$output .= '</div><div class="clear"></div>'.$this->endBlockComment('row');
}
echo $output;
