<?php
/**
 * File to define functions and hooks related to preloader
 * 
 * @package Yaatra
 */

if ( ! function_exists( 'yaatra_preloader_items' ) ) :

	/**
	 * function to manage the requested preloader items
	 * 
	 * @since 1.0.0
	 */
	function yaatra_preloader_items() {
		$yaatra_preloader_enable = yaatra_get_customizer_option_value( 'yaatra_preloader_enable' );

		if ( false === $yaatra_preloader_enable ) {
			return;
		}

		$yaatra_preloader_style = yaatra_get_customizer_option_value( 'yaatra_preloader_style' );

?>
		<div id="yaatra-preloader" class="preloader-background">
			<div class="preloader-wrapper">
				<?php
					switch ( $yaatra_preloader_style ) {
						case 'three_bounce':
				?>
							<div class="yaatra-three-bounce">
	                            <div class="az-child az-bounce1"></div>
	                            <div class="az-child az-bounce2"></div>
	                            <div class="az-child az-bounce3"></div>
	                        </div>
				<?php
							break;

						case 'wave':
				?>
							<div class="yaatra-wave">
	                            <div class="az-rect az-rect1"></div>
	                            <div class="az-rect az-rect2"></div>
	                            <div class="az-rect az-rect3"></div>
	                            <div class="az-rect az-rect4"></div>
	                            <div class="az-rect az-rect5"></div>
	                        </div>
				<?php
							break;

						case 'folding_cube':
				?>
							<div class="yaatra-folding-cube">
	                            <div class="az-cube1 az-cube"></div>
	                            <div class="az-cube2 az-cube"></div>
	                            <div class="az-cube4 az-cube"></div>
	                            <div class="az-cube3 az-cube"></div>
	                        </div>
				<?php
							break;
						
						default:
				?>
							<div class="yaatra-three-bounce">
	                            <div class="az-child az-bounce1"></div>
	                            <div class="az-child az-bounce2"></div>
	                            <div class="az-child az-bounce3"></div>
	                        </div>
				<?php
							break;
					}
				?>
			</div><!-- .preloader-wrapper -->
		</div><!-- #yaatra-preloader -->
<?php
	}

endif;

add_action( 'yaatra_before_page', 'yaatra_preloader_items', 5 );