﻿/* tendine 4° liv */

$(document).ready(function() {

    $("#boxBannerSX").cycle({
        fx: 'scrollHorz',
        timeout: 6000
    });

    /*$(' .cssBoxTab:first').css("display", "block");*/
    //Get all the LI from the #cssTabsTab UL
    $('#cssTabsTab > li').click(function() {
        /*if ($(this).hasClass('selected')) return;*/
        var idEl = $('.boxBody .cssBoxTab:eq(' + $('#cssTabsTab .cssTabTab').index(this) + ')').attr('id');

        $('#' + idEl + ' .titoloInternaTendina:first').addClass('selected');
        $('#' + idEl + ' .descInternaTendina:first').css("display", "block");
        


        //remove the selected class from all LI    
        $('#cssTabsTab > li').removeClass('selected');

        //Reassign the LI

        $(this).addClass('selected');

        //Hide all the DIV in .boxBody
        $('.boxBody .cssBoxTab').stop(false, true).hide();

        //Look for the right DIV in boxBody according to the Navigation UL index, therefore, the arrangement is very important.
        $('.boxBody .cssBoxTab:eq(' + $('#cssTabsTab > li').index(this) + ')').animate({ "height": "toggle", "opacity": "toggle" }, "slow");
        //.slideDown('1500').fadeIn('2000');

    }).mouseover(function() {

        //Add and remove class, Personally I dont think this is the right way to do it, anyone please suggest    
        $(this).addClass('mouseover');
        $(this).removeClass('mouseout');

    }).mouseout(function() {

        //Add and remove class
        $(this).addClass('mouseout');
        $(this).removeClass('mouseover');

    });

});

/* fine tendine 4° liv */

/* tendine intenre*/
$(document).ready(function() {
$('#internaTendina .titoloInternaTendina').click(function() {

    if ($(this).hasClass('selected')) {
        $('#internaTendina .descInternaTendina:eq(' + $('#internaTendina .titoloInternaTendina').index(this) + ')').animate({ "height": "toggle", "opacity": "toggle" }, "slow");
        $('#internaTendina .titoloInternaTendina').removeClass('selected');
    }
    else {
        $('#internaTendina .titoloInternaTendina').removeClass('selected');
        $(this).addClass('selected');
        $('#internaTendina .descInternaTendina').stop(false, true).hide();
        $('#internaTendina .descInternaTendina:eq(' + $('#internaTendina .titoloInternaTendina').index(this) + ')').animate({ "height": "toggle", "opacity": "toggle" }, "slow");
    }

});
$('#internaTendina .titoloInternaTendina:first').addClass('selected');
$('#internaTendina .descInternaTendina:first').css("display", "block");

$('.internaTendinaTerritorio .titoloInternaTendina').click(function() {

    if ($(this).hasClass('selected')) {
        $('.internaTendinaTerritorio .descInternaTendina:eq(' + $('.internaTendinaTerritorio .titoloInternaTendina').index(this) + ')').animate({ "height": "toggle", "opacity": "toggle" }, "slow");
        $('.internaTendinaTerritorio .titoloInternaTendina').removeClass('selected');
    }
    else {
        $('.internaTendinaTerritorio .titoloInternaTendina').removeClass('selected');
        $(this).addClass('selected');
        $('.internaTendinaTerritorio .descInternaTendina').stop(false, true).hide();
        $('.internaTendinaTerritorio .descInternaTendina:eq(' + $('.internaTendinaTerritorio .titoloInternaTendina').index(this) + ')').animate({ "height": "toggle", "opacity": "toggle" }, "slow");
    }

});
$('.internaTendinaTerritorio .titoloInternaTendina:first').addClass('selected');
$('.internaTendinaTerritorio .descInternaTendina:first').show();
});
/* fine tendine interne*/

/* tendine eventi territorio*/
$(document).ready(function() {
$('.internaTendinaEventiTerritorio .titoloInternaTendinaEventi').click(function() {
        if ($(this).hasClass('selected')) {
            $('.internaTendinaEventiTerritorio .descInternaTendinaEventi:eq(' + $('.internaTendinaEventiTerritorio .titoloInternaTendinaEventi').index(this) + ')').animate({ "height": "toggle", "opacity": "toggle" }, "slow");
            $('.internaTendinaTerritorio .titoloInternaTendinaEventi').removeClass('selected');
        } else {
            $('.internaTendinaTerritorio .titoloInternaTendinaEventi').removeClass('selected');
            $(this).addClass('selected');
            $('.internaTendinaEventiTerritorio .descInternaTendinaEventi').stop(false, true).hide();
            $('.internaTendinaEventiTerritorio .descInternaTendinaEventi:eq(' + $('.internaTendinaEventiTerritorio .titoloInternaTendinaEventi').index(this) + ')').animate({ "height": "toggle", "opacity": "toggle" }, "slow");
        }

    });
    //$('#internaTendinaEventi .titoloInternaTendinaEventi:first').addClass('selected');
    //$('#internaTendinaEventi .descInternaTendinaEventi:first').css("display", "block");
});



/* tendine eventi*/
$(document).ready(function() {
    $('#internaTendinaEventi .titoloInternaTendinaEventi').click(function() {
        if ($(this).hasClass('selected')) {
            $('#internaTendinaEventi .descInternaTendinaEventi:eq(' + $('#internaTendinaEventi .titoloInternaTendinaEventi').index(this) + ')').animate({ "height": "toggle", "opacity": "toggle" }, "slow");
            $('#internaTendina .titoloInternaTendinaEventi').removeClass('selected');
        } else {
            $('#internaTendina .titoloInternaTendinaEventi').removeClass('selected');
            $(this).addClass('selected');
            $('#internaTendinaEventi .descInternaTendinaEventi').stop(false, true).hide();
            $('#internaTendinaEventi .descInternaTendinaEventi:eq(' + $('#internaTendinaEventi .titoloInternaTendinaEventi').index(this) + ')').animate({ "height": "toggle", "opacity": "toggle" }, "slow");
        }

    });
    //$('#internaTendinaEventi .titoloInternaTendinaEventi:first').addClass('selected');
    //$('#internaTendinaEventi .descInternaTendinaEventi:first').css("display", "block");
});
/* fine tendine eventi*/


/*PopUp*/


/*Funzione che apre un popup centrato*/
function newWindowTelecamere(a_str_windowURL) {
    window.open(a_str_windowURL, 'PopWebCam', 'scrollbars=no,resizable=no,status=no,location=no,toolbar=no,width=360,height=410,top=0,left=0');
}
