﻿
function setup360toggle() {
    jQuery(".button360").toggle(
        function() {
            jQuery('#button360').attr('title', 'Close 360 degree view');
            jQuery('#button360 img').attr('alt', 'Close 360 degree view');
            jQuery('#button360 img').attr('src', '/lib/img/new-icons/icoClose.png');
            jQuery(".div360view").show();
        }
        , function() {
            jQuery('#button360').attr('title', '360 degree view');
            jQuery('#button360 img').attr('alt', '360 degree view');
            jQuery('#button360 img').attr('src', '/lib/img/new-icons/ico360view.png');
            jQuery(".div360view").hide();
        }
    );
}

function setupZoom() {
    jQuery(".buttonzoom").click(
        function() { jQuery(".divzoom").show(); MagicZoom.refresh(); return false; }
    );
    jQuery(".icozoomclose").click(
        function() { jQuery(".divzoom").hide(); return false; }
    );
    jQuery(".buttonalternateimage").click(
        function() {
            CurrentClientSideDisplayedImage = CurrentClientSideDisplayedImage >= ImageCount - 1 ? 0 : CurrentClientSideDisplayedImage + 1;
            jQuery('img.productimage').attr('src', standardUrls[CurrentClientSideDisplayedImage]);
        }
    );
}

function SwapZoomImage(imageName) {
    jQuery('#mgzoom').attr('href', imageName.replace('360x360', 'zoom'));
    jQuery('#mgzoom img').attr('src', imageName);
    MagicZoom.refresh();
}
