<?php
if ( ot_get_option( 'enable_content_top_sidebar', 'off' ) == 'on' ) {
	$content_top_sidebar = leap_override_widget_position( 'content_top_sidebar', 'leap_content_top_sidebar' );
	if ( $content_top_sidebar != 'none' ) {

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

		$active_sidebar = array();
		for ( $i = 1; $i <= $col_count; $i++ ) {
			$replacement_sidebar = leap_get_replacement_sidebar( '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();
			$title_parallax	 = leap_get_sidebar_option_with_default( 'leap_contenttop_sidebar_parallax_background_image', $sidebar_id );
			?>
			<div id="content-top-sidebar" <?php echo (in_array( $title_parallax, array( 'on', 'yes' ) ) ? 'class="leap-parallax"' : '') ?>>
				<div class="row">
					<?php
					for ( $i = 1; $i <= $col_count; $i++ ) {
						echo '<div class="' . leap_bws_col_class( $content_top_sidebar[ $i - 1 ] ) . '" >';
						leap_dynamic_sidebar( 'content-top' . $i );
						echo '</div>';
					}
					?>
				</div>
			</div>
			<?php
		}
	}
}