<?php 
	global $passport_number;
    global $passport_section_settings;
    global $passport_sidebar_width;

	$number_of_section	= 5;
	$i					= $number_of_section-1;

		for ( $i=1; $i <= $number_of_section-1; $i++ ) :

            $column = 'main_content';
            $position = 'left';
            $sidebar_width = 'sidebar_25';

            if ( 2 == $i ) {
                $column = 'sidebar';
                $position = 'right';
                $sidebar_width  = 'sidebar_25';
            } elseif ( 3 == $i ) {
                $column = 'sidebar';
                $position = 'left';
                $sidebar_width = 'sidebar_25';
            }

			$passport_section_settings	= get_theme_mod( 'passport_section_'. $i.'_settings', $column );
			$passport_sidebar_position	= get_theme_mod( 'passport_section_'. $i.'_sidebar_position', $position );
			$passport_sidebar_width		= get_theme_mod( 'passport_section_'. $i.'_sidebar_width', 'sidebar_25' );
            $passport_headline_column	= get_theme_mod( 'passport_headline_column', 'sidebar' );

    		
			if ( isset( $passport_section_settings ) && 'main_content' == $passport_section_settings ) { 
				$passport_number = 8; 
			} else { 
				$passport_number = 7; 
			} 
	?>
		<div id="section-<?php echo $i; ?>" class="<?php if( 'main_content' == $passport_section_settings ) { echo 'main-content'; } else { echo 'sidebar'; } ?> layout">
			<?php if( 'main_content' == $passport_section_settings ) : ?>
		        <?php dynamic_sidebar( PASSPORT_THEME_SLUG . '-section-'. $i .'' ); ?>
			<?php elseif( 'sidebar' == $passport_section_settings )  : ?>
				<?php if( 'right' == $passport_sidebar_position ) : ?>
					<?php if( 'sidebar_25' == $passport_sidebar_width ) : ?>
						<div class="col-xs-12 col-sm-12 col-md-9 col-lg-9">
					<?php elseif( 'sidebar_33' == $passport_sidebar_width ) : ?>
						<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8">
					<?php endif; ?><!--End of loop -->
							<div class="row">
								<?php dynamic_sidebar( PASSPORT_THEME_SLUG . '-section-'. $i .'' ); ?>
							</div>
					<?php if( 'sidebar_25' == $passport_sidebar_width ) : ?>
						</div>
					<?php elseif( 'sidebar_33' == $passport_sidebar_width ) : ?>
						</div>
					<?php endif; ?><!--End of loop -->

					<?php if( 'sidebar_25' == $passport_sidebar_width ) : ?>
						<div class="col-xs-12 col-sm-12 col-md-3 col-lg-3">
					<?php elseif( 'sidebar_33' == $passport_sidebar_width) : ?>
						<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
					<?php endif; ?><!--End of loop -->
							<div class="row">
								<div class="right-sidebar">
									<?php dynamic_sidebar( PASSPORT_THEME_SLUG . '-sidebar-'. $i .'' ); ?>
								</div>
							</div>
					<?php if( 'sidebar_25' == $passport_sidebar_width ) : ?>
						</div>
					<?php elseif( 'sidebar_33' == $passport_sidebar_width) : ?>
						</div>
					<?php endif; ?><!--End of loop -->
				<?php endif; ?><!-- End of Right Sidebar -->

				<?php if ( 'left' == $passport_sidebar_position ) : ?>
					<?php if( 'sidebar_25' == $passport_sidebar_width ) : ?>
						<div class="col-xs-12 col-sm-12 col-md-3 col-lg-3">
					<?php elseif( 'sidebar_33' == $passport_sidebar_width) : ?>
						<div class="col-xs-12 col-sm-12 col-md-4 col-lg-4">
					<?php endif; ?><!--End of loop -->
							<div class="row">
								<div class="left-sidebar">
									<?php dynamic_sidebar( PASSPORT_THEME_SLUG . '-sidebar-'. $i .'' ); ?>
								</div>
							</div>
					<?php if( 'sidebar_25' == $passport_sidebar_width ) : ?>
						</div>
					<?php elseif( 'sidebar_33' == $passport_sidebar_width) : ?>
						</div>
					<?php endif; ?><!--End of loop -->
					<?php if( 'sidebar_25' == $passport_sidebar_width ) : ?>
						<div class="col-xs-12 col-sm-12 col-md-9 col-lg-9">
					<?php elseif( 'sidebar_33' == $passport_sidebar_width) : ?>
						<div class="col-xs-12 col-sm-12 col-md-8 col-lg-8">
					<?php endif; ?><!--End of loop -->
							<div class="row">
								<?php dynamic_sidebar( PASSPORT_THEME_SLUG . '-section-'. $i .'' ); ?>
							</div>
					<?php if( 'sidebar_25' == $passport_sidebar_width ) : ?>
						</div>
					<?php elseif( 'sidebar_33' == $passport_sidebar_width) : ?>
						</div>
					<?php endif; ?><!--End of loop -->
					<?php endif; ?><!-- End of Left Sidebar -->
				<?php endif;  ?><!-- End of Loop -->
			</div>
	<?php endfor;