/**
 * Display slide's media.
 *
 * @since 1.1.0
 *
 * @param array $atts Media attributes from themeblvd_sliders_get_media_atts()
 * @param array $settings Current settings of slider
 * @param string $slider_type Type of slider, standard, nivo, carrousel, bootstrap, or fallback
 */
function themeblvd_slide_media($atts, $settings, $slider_type = 'standard')
{
    echo themeblvd_get_slide_media($atts, $settings, $slider_type);
}
/**
 * Nivo - default action for themeblvd_nivo_slider
 *
 * @since 1.1.0
 *
 * @param var $slider ID of current slider
 * @param array $settings Current settings for slider
 * @param array $slides Current slides for slider
 */
function themeblvd_nivo_slider_default($slider, $settings, $slides)
{
    // Extend slides
    $slides = apply_filters('themeblvd_nivo_slides', $slides, $slider, $settings);
    // With some different user options and ways this function
    // can be utilized, there are going to be some inconsitancy
    // with booleans. Let's fix that.
    if ($settings['nav_standard'] === false || $settings['nav_standard'] == '0' || $settings['nav_standard'] == 'false') {
        $settings['nav_standard'] = false;
    }
    if ($settings['nav_arrows'] === false || $settings['nav_arrows'] == '0' || $settings['nav_arrows'] == 'false') {
        $settings['nav_arrows'] = false;
    }
    // Configure additional CSS classes
    $classes = themeblvd_get_classes('slider_nivo', true);
    $classes .= $settings['nav_standard'] ? ' show-nav_standard' : ' hide-nav_standard';
    $classes .= $settings['nav_arrows'] ? ' show-nav_arrows' : ' hide-nav_arrows';
    if (!$settings['nav_standard'] && !$settings['nav_arrows']) {
        $classes .= ' hide-full_nav';
    }
    $classes = apply_filters('themeblvd_slider_wrapper_classes', $classes);
    // Hide on mobile?
    $hide = '';
    if (isset($settings['mobile_fallback'])) {
        if ($settings['mobile_fallback'] == 'full_list' || $settings['mobile_fallback'] == 'first_slide') {
            $hide = true;
        }
    }
    // Insert javascript
    do_action('themeblvd_nivo_slider_js', $slider, $settings);
    ?>

	<div id="tb-slider-<?php 
    echo $slider;
    ?>
" class="slider-wrapper tb-nivo-slider-wrapper nivo-slider-wrapper<?php 
    if ($hide) {
        echo ' slider_has_mobile_fallback';
    }
    ?>
">
		<div class="slider-inner<?php 
    echo $classes;
    ?>
">
			<div class="slides-wrapper slides-wrapper-<?php 
    echo $slider;
    ?>
">
				<div class="slides-inner">
					<div class="tb-loader"></div>
					<?php 
    if ($slides) {
        ?>
						<div class="slider nivoSlider">
							<?php 
        foreach ($slides as $slide) {
            $image = themeblvd_get_slide_media(themeblvd_sliders_get_media_atts($slider, $slide, $settings, 'nivo'), $settings, 'nivo');
            if (themeblvd_slide_has_element('headline', $slide) || themeblvd_slide_has_element('description', $slide)) {
                $image = str_replace(' />', sprintf(' title="#%s" />', $slide['slide_id'] . '_desc'), $image);
            }
            echo $image = apply_filters('themeblvd_nivo_image', $image, $slider, $slide, $settings) . "\n";
        }
        ?>
				        </div><!-- .nivoSlider (end) -->
				        <?php 
        foreach ($slides as $slide) {
            ?>
				        	<?php 
            if (themeblvd_slide_has_element('headline', $slide) || themeblvd_slide_has_element('description', $slide)) {
                ?>
				        		<div id="<?php 
                echo $slide['slide_id'] . '_desc';
                ?>
" class="nivo-html-caption">
				        			<?php 
                themeblvd_slide_content($slider, $slide, $settings, 'nivo');
                ?>
				        		</div>
				        	<?php 
            }
            ?>
				        <?php 
        }
        ?>
			    	<?php 
    }
    ?>
    			</div><!-- .slides-inner (end) -->
			</div><!-- .slides-wrapper (end) -->
		</div><!-- .slider-inner (end) -->
		<div class="design-1"></div>
		<div class="design-2"></div>
		<div class="design-3"></div>
		<div class="design-4"></div>
	</div><!-- .slider-wrapper (end) -->
    <?php 
    // Display fallback if necessary
    if (isset($settings['mobile_fallback'])) {
        if ($settings['mobile_fallback'] == 'full_list' || $settings['mobile_fallback'] == 'first_slide') {
            do_action('themeblvd_slider_fallback', $slider, $slides, $settings['mobile_fallback'], $settings);
        }
    }
}