<?php
/**
 * Single Product Thumbnails
 *
 * This template can be overridden by copying it to yourtheme/woocommerce/single-product/product-thumbnails.php.
 *
 * HOWEVER, on occasion WooCommerce will need to update template files and you (the theme developer).
 * will need to copy the new files to your theme to maintain compatibility. We try to do this.
 * as little as possible, but it does happen. When this occurs the version of the template file will.
 * be bumped and the readme will list any important changes.
 *
 * @see 	    http://docs.woothemes.com/document/template-structure/
 * @author 		WooThemes
 * @package 	WooCommerce/Templates
 * @version     2.3.0
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}

global $post, $product, $woocommerce;

$attachment_ids = $product->get_gallery_attachment_ids();

if ( $attachment_ids ) {
	$loop 		= 0;
	$columns 	= apply_filters( 'woocommerce_product_thumbnails_columns', 1 );
	?>
	<div class="thumbnails <?php echo 'columns-' . $columns; ?>">
		<div class="thumbnails-slide anim-medium">
		<?php

		foreach ( $attachment_ids as $attachment_id ) {
			?>
			<div class="thumb-image">
				<div class="inner">
					<?php

					$classes = array( 'zoom' );

					if ( $loop === 0 || $loop % $columns === 0 )
						$classes[] = 'first';

					if ( ( $loop + 1 ) % $columns === 0 )
						$classes[] = 'last';

					$image_link = wp_get_attachment_url( $attachment_id );

					if ( ! $image_link )
						continue;

					$image_title 	= esc_attr( get_the_title( $attachment_id ) );
					$image_caption 	= esc_attr( get_post_field( 'post_excerpt', $attachment_id ) );

					$image       = wp_get_attachment_image( $attachment_id, apply_filters( 'single_product_small_thumbnail_size', 'pequeno' ), 0, $attr = array(
						'title'	=> $image_title,
						'alt'	=> $image_title
						) );

					$image_class = esc_attr( implode( ' ', $classes ) );

					echo apply_filters( 'woocommerce_single_product_image_thumbnail_html', sprintf( '<a href="%s" class="%s" title="%s" data-rel="prettyPhoto[product-gallery]"><div class="aligner"></div>%s</a>', $image_link, $image_class, $image_caption, $image ), $attachment_id, $post->ID, $image_class );

					$loop++;
					?>
				</div>
			</div>
		<?php
		}
		?>
		</div>
		
	</div>
	<?php
		if($loop > 3){
			?>
			<div class="thumbnails-navigation">
				<div class="go-up anim-fast invisible">
					<svg x="0px" y="0px" width="30.4px" height="17.5px" viewBox="0 0 30.4 17.5" enable-background="new 0 0 30.4 17.5">
					<path fill="#939598" d="M15.2,0c-0.6,0-1.2,0.2-1.7,0.7L0.7,13.5c-0.9,0.9-0.9,2.4,0,3.2c0.9,0.9,2.4,0.9,3.2,0l11.3-11l11.3,11
						c0.9,0.9,2.4,0.9,3.2,0c0.9-0.9,0.9-2.4,0-3.2L16.9,0.7C16.4,0.2,15.8,0,15.2,0z"/>
					</svg>
				</div>
				<div class="go-down anim-fast">
					<svg x="0px" y="0px" width="30.4px" height="17.5px" viewBox="0 0 30.4 17.5" enable-background="new 0 0 30.4 17.5">
					<path fill="#939598" d="M15.2,17.5c0.6,0,1.2-0.2,1.7-0.7L29.8,3.9c0.9-0.9,0.9-2.4,0-3.2s-2.4-0.9-3.2,0l-11.3,11L3.9,0.7
						C3-0.2,1.6-0.2,0.7,0.7c-0.9,0.9-0.9,2.4,0,3.2l12.9,12.9C14,17.3,14.6,17.5,15.2,17.5z"/>
					</svg>
				</div>
			</div>
			<?php
		}
}
