
/* - ++resource++sanmartin.store.js/slideshow.js - */
jq(document).ready(function(){

    jq("#slideshow .image:first").addClass("active");

    //var current = 0;

    jq("#item-left").click(function() {
        slideSwitch('left');
    });

    jq("#item-right").click(function() {
        slideSwitch('right');
    });
    jq(function() {
        setInterval( "slideSwitch('right')", 20000 );
    });
});

function slideSwitch(direction) {
    var $active = jq('.items div.active');

    if (direction == 'right') {
        if ( $active.length == 0 ) $active = $('.items .image:last');
        var $position = $active.next().length ? $active.next() : $('.items .image:first');
    }
    if (direction == 'left') {
        if ( $active.length == 0 ) $active = $('.items .image:first');
        var $position = $active.prev().length ? $active.prev() : $('.items .image:last');
    }
    $position.addClass('last-active');
    $active.removeClass('last-active');
    $position.css({opacity: 0.0}).addClass('active').animate({opacity: 1.0}, 1000, function() {
        $active.removeClass('active');
    });
}


jq(document).ready(function(){

    jq('.product-image a').prepOverlay({
         subtype: 'image',
         urlmatch: '/image_view_fullscreen$',
         urlreplace: '_preview'
    });
});

jq(document).ready(function(){

    jq('.redunicre-logos .vbv_link').prepOverlay({
         subtype: 'image',
         urlmatch: '/image_view_fullscreen$',
         urlreplace: '_preview'
    });
});


jq(document).ready(function(){

    jq('.online-payments .customer_cod').prepOverlay({
         subtype: 'image',
         urlmatch: '/image_view_fullscreen$',
         urlreplace: '_preview'
    });
});

jq(document).ready(function(){

    jq('.online-payments .ref').prepOverlay({
         subtype: 'image',
         urlmatch: '/image_view_fullscreen$',
         urlreplace: '_preview'
    });
});



