<?php
$number_photos = -1; 		// -1 to display all
$photo_width = 920;		// Width of photo
$photo_height = 613;		// Width of photo
$themeurl = get_template_directory_uri();

$attachments = get_children( array(
'post_parent' => $post->ID,
'numberposts' => $number_photos,
'post_type' => 'attachment',
'post_mime_type' => 'image',
'order' => 'ASC', 
'orderby' => 'menu_order date')
);

$counter = 0;

if ( !empty($attachments) ) :	
	$photo_output = '';
	$thumb_output = '';	
	foreach ( $attachments as $att_id => $attachment ) {
		$counter++;
		
		# Caption
		$caption = "";
		if ($attachment->post_excerpt) {
			$caption = '<div class="postcaption"><p>' . $attachment->post_excerpt . '</p></div>';
		}
	
		# Large photo
		$src = wp_get_attachment_image_src($attachment->ID, 'qs-innerslide', true);
		$full = wp_get_attachment_image_src($attachment->ID, 'large', true);
		
		$photo_output .= '<div class="sliderpic"><img style="width:'.$photo_width.'px;height:'.$photo_height.';display:block;" src="'. $src[0] .'" alt="" />'. $caption .'</div>';
	}  
endif; ?>

<?php if ($counter > 1) : ?>
	<div class="inner-cycle">
		<div class="cycle-slideshow" 
		<?php if(of_get_option('of_inner_rotate') == 1) { ?>
			data-cycle-pause-on-hover="true"
			data-cycle-timeout="<?php echo of_get_option('of_inner_speed'); ?>000"
		<?php } else { ?>
			data-cycle-timeout="0"
		<?php } ?>
		data-cycle-loader="true"
		data-cycle-pager=".template-pager"
		data-cycle-slides="> div"
		data-cycle-prev=".innerslider_prev"
		data-cycle-next=".innerslider_next"
		>	
		<?php echo $photo_output; ?>
		</div>
		<div class="template-pager"></div>
		
		<div class="prevnext_controls">
			<a class="innerslider_prev"><img src="<?php echo get_template_directory_uri(); ?>/images/arrow-prev.png" alt="<?php _e('Previous','gabfire'); ?>" /></a>
			<a class="innerslider_next"><img src="<?php echo get_template_directory_uri(); ?>/images/arrow-next.png" alt="<?php _e('Next','gabfire'); ?>" /></a>
		</div>
	</div><!-- cycle-slideshow -->
<?php endif; ?>

