﻿$(document).ready(function() {
    // Prepair for FancyBox
    $("#product-images-tab > div#imageTab1 a img").each(function() {
        // Set the group
        $(this).closest("a").attr("rel", $(this).closest("div").attr("id"));

        // Get the link info
        var hiresSrc = $(this).closest("a").attr("longdesc");
        var hiResText = $(this).attr("title");

        // Construct the hires link
        var hiresHref = "<a href=\"" + hiresSrc + "\">" + hiResText + "</a>";
        $(this).closest("a").attr("longdesc", hiresHref);

        // Remove the used attributes in the image
        $(this).removeAttr("title");
    });

    // Load FancyBox, but only for items in specifik id
    $("#product-images-tab > div a").fancybox({
        'hideOnContentClick': false,
        'imageScale': true
    });
});