<?php
/**
 * Slider template
 *
 * @package Moesia
 */

//Load the script for the slider
function moesia_slider_scripts() {
	if ( get_theme_mod('slider_display') ) {
			
		wp_enqueue_script( 'moesia-superslides', get_template_directory_uri() . '/js/jquery.superslides.min.js', array(), true );
					
	}		
}
add_action( 'wp_enqueue_scripts', 'moesia_slider_scripts' );

//Slider template
function moesia_slider_template() { ?>
	<div id="slides">
	    <div class="slides-container">
		    <?php 
			    if ( get_theme_mod('slider_image_1') ) {
					echo '<img src="' . esc_url(get_theme_mod('slider_image_1')) . '">';
				}
			    if ( get_theme_mod('slider_image_2') ) {
					echo '<img src="' . esc_url(get_theme_mod('slider_image_2')) . '">';
				}			
			    if ( get_theme_mod('slider_image_3') ) {
					echo '<img src="' . esc_url(get_theme_mod('slider_image_3')) . '">';
				}
			    if ( get_theme_mod('slider_image_4') ) {
					echo '<img src="' . esc_url(get_theme_mod('slider_image_4')) . '">';
				}
			    if ( get_theme_mod('slider_image_5') ) {
					echo '<img src="' . esc_url(get_theme_mod('slider_image_5')) . '">';
				}				
			?>	
	    </div>
	</div>
	<?php	
}