﻿
function selectProductVariant(pvId) {
    $("#prodshop-views li").addClass("disp-n");
    $("#prodshop-thumbs a[rel]").each(
        function() {
            if ($(this).attr("rel") == "color" + pvId) {
                var relImg = $(this).attr("rel");
                $("#prodshop-views li").not("disp-n").addClass("disp-n");
                $("#" + relImg).removeClass("disp-n");
            }


        });

    }

    $(function() {

        //        /**///galeria
        //        //symulacja bazy - pobrane ajaxowo dane można wrzucić do takiego obiektu
        //        var imgCombos = {
        //            img01: { path: "/img/uploads/sample-big.jpg",
        //                descr: "Ectatia con conserunto tempos sunto core nis et eicimint"
        //            },
        //            img02: { path: "/img/uploads/img-main-02.jpg",
        //                descr: "Litwo ojczyzno moja tyś jest jak zdrowie ;D"
        //            },
        //            img03: { path: "/img/uploads/sample-big02.jpg",
        //                descr: "Just to show how it works"
        //            }
        //        }

        //        //pierwszy element ze slideshowu
        //        var firstToDisplay = $("#zb-images li:first a").attr("rel");

        //        //wyświetlenie danych powiązanych z pierwszym elementem
        //        jQuery.each(imgCombos, function(i, val) {

        //            if (i.toString() == firstToDisplay) {
        //                newPath = val.path;
        //                newDescr = val.descr;
        //                $(".img-preview").append("<img src=\"" + newPath + "\" />");
        //                $(".img-caption").text(newDescr);
        //            }

        //        });

        //        //kliknięcie na miniaturę
        //        $("#zb-images a").click(function() {
        //            var getThis = $(this).attr("rel")
        //            jQuery.each(imgCombos, function(i, val) {

        //                if (i.toString() == getThis) {
        //                    newPath = val.path;
        //                    newDescr = val.descr;
        //                    $(".img-preview img").attr("src", newPath);
        //                    $(".img-caption").text(newDescr);
        //                }

        //            });
        //        });

        /**///wstępne ukrycie na starcie
        $("#guidanceContent > ul > li:not(:first), .questions > li .answer, #prod-views li:not(:first)").addClass("disp-n");
        $("#guidanceTopics > ul > li > a:first").addClass("Orange");
        
        /**///obsługa menu bocznego współgrającego ze scrolowanym contentem	
        $("#guidanceTopics a[rel]").click(function() {
		
            var relContent = $(this).attr("rel");
            $("#guidanceContent > ul > li").not("disp-n").addClass("disp-n");
            $("#" + relContent).removeClass("disp-n");

            $("#guidanceTopics a[rel]").removeClass("Orange");
            $(this).addClass("Orange");
        });

        /**///obsługa kliknięcia na miniaturę produktu
        $("#prod-thumbs a[rel]").click(function() {
            var relImg = $(this).attr("rel");
            $("#prod-views li").not("disp-n").addClass("disp-n");
            $("#" + relImg).removeClass("disp-n");
        });


        /**///obsługa ukazania alternatywnego widoku produktu	
        $("#prod-views li").hover(
		function() {
		    $(this).find("img:first").next().addClass("show");
		},
		function() {
		    $(this).find("img:first").next().removeClass("show");
		}
	    );

        /**///obsługa ukazania alternatywnego widoku produktu


        $("#prodshop-views").delegate('li', 'mouseover mouseleave', function(e) {
            if (e.type == 'mouseover') {
                $(this).find("img:first").next().addClass("show");
            } else {
                $(this).find("img:first").next().removeClass("show");

            }
        });

        $("#prodshop-views li").hover(
		function() {
		    $(this).find("img:first").next().addClass("show");
		},
		function() {
		    $(this).find("img:first").next().removeClass("show");
		}
	);



        /**///obsługa FAQ
        $(".questions > li h3 a").click(function() {
            $(".questions > li a").not(this).parent("h3").next(".answer").addClass("disp-n");
            $(this).parent("h3").next(".answer").toggleClass("disp-n");
        });




    });
