<%@ page import="zall.bean.*" %>
<%@ page import="java.util.List" %>
<%
List<Image> imgs = (List<Image>)request.getAttribute("images");
Image start_img = (Image)request.getAttribute("image");
int start_id = 0;
%>
    <DIV id="main">
	<DIV id="container">
		<DIV id="content">
			    <div id="slideshow">
                    <% 
                    int i = 0;
                    for( Image image : imgs ){ 
                    	if( image == start_img ) 
                    		start_id = i;
                    	i++;
                    %>       
                    <a href="media?type=<%=image.getType() %>&id=<%=image.getId() %>">
                        <img src="content?type=<%=image.getType() %>&&id=<%=image.getId()%>&size=medium" alt="<%=image.getTitle()%>">
                        <span class="desc"><%=( image.getDescription()!=null ? image.getDescription() : "No description available" ) %></span>
                    </a>                    
                    <% } %>
                </div>
             
                <script>                
                    // Load theme
                    Galleria.loadTheme('js/galleria/themes/classic/galleria.classic.min.js');
                    
                    // run galleria and add some options
                    jQuery('#slideshow').galleria({
                    	show: <%=start_id %>,
                        imageCrop: false,
                        transition: 'slide',
                        popupLinks: false,
                        autoplay: true,
                        carousel: true,
                        height: 450,
                        dataConfig: function(img) {
                            return {
                            	title: $(img).attr('alt'), // sets title to "John Doe",
                            	description: $(img).next('.desc').html() // sets description to "My picture"
                            };
                        }
                    });
                </script>
		</DIV><!-- #content -->
	</DIV><!-- #container -->
    </DIV><!-- #main -->