﻿//lightbox jquery
$(function() {
    $('.linkLightbox').lightBox();
    $('#RotatorNews').cycle({
        fx: 'scrollHorz',
        sync: 1,
        speed: 1000,
        timeout: 4000,
        //pager: '#navGallery',
        next: '#nextImg',
        prev: '#prevImg',
        pause: 1
    });
    $('#RotatorTestate').cycle({
        fx: 'fade',
        sync: 1,
        speed: 1000,
        timeout: 4000,
        pager: '#navGallery',
        pagerAnchorBuilded: removeTestoNavigator
        //next: '#nextImg',
        //prev: '#prevImg',
        //pause: 1
    });

    $("a[rel^='prettyPhoto']").prettyPhoto({ animationSpeed: 'fast', slideshow: 4000 });

    /*$("#LinkPhotogallery").click(function() {
    $("#gallery a[rel^='prettyPhoto']").prettyPhoto({ animationSpeed: 'fast', slideshow: 4000 }).prettyPhoto.open();
    });*/



    function removeTestoNavigator() {
        $("#navGallery a").html("&nbsp;");
        $("#navGallery a:first").addClass("first");
        $("#navGallery").css("left", ($("#navGallery").parent().width() / 2) - $("#navGallery").width());
    }

    $(".menuPrincipale > li").hover(function() {
        $(this).children("ul").css("display", "block");
        $(this).addClass("hover");
    }, function() {
        $(this).children("ul").css("display", "none");
        $(this).removeClass("hover");
    });
    $(".LinkDettagliWorkshopOCongresso").click(function() {
        if ($(this).parents(".WorkshopOCongresso").find(".DocumentiWorkshopOCongresso").css("display") == "none") {
            $(this).parents(".WorkshopOCongresso").find(".DocumentiWorkshopOCongresso").slideDown();
            $(this).html($("#VocaboloChiudiDettagli").html());
            $(this).css("background-color", "#FFFFFF");
            $(this).css("color", "#8b8b8b");
            $(this).parents(".WorkshopOCongresso").find(".DocumentiWorkshopOCongresso").css("display", "block");
        }
        else {
            $(this).html($("#VocaboloDettagli").html());
            $(this).css("background-color", "#8b8b8b");
            $(this).css("color", "#FFFFFF");
            $(this).parents(".WorkshopOCongresso").find(".DocumentiWorkshopOCongresso").slideUp();
            $(this).parents(".WorkshopOCongresso").find(".DocumentiWorkshopOCongresso").css("display", "none");

        }
    });

    function interrogate(what) {
        var output = '';
        for (var i in what)
            output += i + '<br />';
        //alert(output);
        document.getElementById("test").innerHTML = output;
    }

    $(function() {
        $(".Tabs.firstopen .DescrizioneTab:first").slideDown();
        $(".Tabs.firstopen .TitoloTab:first").css("background-image", "url('" + m_strPath + "/private_images/varie/frecciaSu.jpg')");

        $(".Tabs .TitoloTab").click(function() {
            /*if (!$(".Tabs .DescrizioneTab:eq(" + ($(this).index()) + ")").is(':visible')) {
            $(".Tabs .DescrizioneTab").stop(true, true).slideUp();
            $(".Tabs .TitoloTab").css("background-image", "url('" + m_strPath + "/private_images/varie/frecciaGiu.jpg')");
            $(".Tabs .DescrizioneTab:eq(" + ($(this).index()) + ")").slideDown();
            $(this).css("background-image", "url('" + m_strPath + "/private_images/varie/frecciaSu.jpg')");
            }*/
            var idtab = $(this).attr("id");
            idtab = idtab.substr(idtab.indexOf("_") + 1);

            if (!$(".Tabs #DescrizioneTab_" + idtab + "").is(':visible')) {
                $(".Tabs .DescrizioneTab").stop(true, true).slideUp();
                $(".Tabs #TitoloTab_" + idtab).css("background-image", "url('" + m_strPath + "/private_images/varie/frecciaGiu.jpg')");
                $(".Tabs #DescrizioneTab_" + idtab).slideDown();
                $(this).css("background-image", "url('" + m_strPath + "/private_images/varie/frecciaSu.jpg')");
            }
        });
    });

    $(".boxArchieCheckbox").click(
            function() {
                var chbEl = $(this).children("input:first");
                //alert(chbEl.attr("checked"));
                chbEl.attr("checked", !(chbEl.attr("checked")));

                var boolChb = chbEl.attr("checked")
                //alert(boolChb);
                if (boolChb) {
                    $(this).css("background-position", "0 -23px");
                } else {
                    $(this).css("background-position", "0 0");
                }
            }
        );
});

