<?php
if ( ot_get_option( 'enable_main_content_top_sidebar', 'off' ) == 'on' ) {
	$main_content_top_sidebar = leap_override_widget_position( 'main_content_top_sidebar', 'leap_main_content_top_sidebar' );
	if ( $main_content_top_sidebar != 'none' ) {

		$main_content_top_sidebar	 = explode( '-', $main_content_top_sidebar );
		$col_count					 = count( $main_content_top_sidebar );

		$active_sidebar = array();
		for ( $i = 1; $i <= $col_count; $i++ ) {
			$replacement_sidebar = leap_get_replacement_sidebar( 'main-content-top' . $i );
			$active_sidebar[]	 = is_active_sidebar( $replacement_sidebar );
			unset( $replacement_sidebar );
		}

		if ( in_array( 1, $active_sidebar ) ) {
			$sidebar_id				 = leap_get_current_sidebar_style();
			$maincontenttop_parallax = leap_get_sidebar_option_with_default( 'leap_mainleap_contenttop_sidebar_parallax_background_image', $sidebar_id );
			?>
			<div id="main-content-top-sidebar" <?php echo ($maincontenttop_parallax == 'on' ? 'class="leap-parallax" data-type="background" data-speed="5"' : '') ?>>
				<div class="<?php echo apply_filters( 'leap_container_class', 'container-fluid' ); ?>">
					<div class="row">
						<?php
						for ( $i = 1; $i <= $col_count; $i++ ) {
							echo '<div class="' . leap_bws_col_class( $main_content_top_sidebar[ $i - 1 ] ) . '" >';
							leap_dynamic_sidebar( 'main-content-top' . $i );
							echo '</div>';
						}
						?>
					</div>
				</div>
			</div>
			<?php
		}
	}
}