﻿/*
plugin: 
goal:  ottenere l'effetto "Tabs" sulle immagini in homepage, pavimentazioni, sistemi verticali, blocchi per murature.
affect: tabs
*/


jQuery(document).ready(function ($) {
    start = location.hash;
    switch (start) {
    case '#pannello-pavimentazioni':
        selezione = 0;
        break;
    case '#pannello-rocciablock':
        selezione = 0;
        break;
    case '#pannello-blocchi-divisori':
        selezione = 0;
        break;
    case '#pannello-rockwood':
        selezione = 0;
        break;
    case '#pannello-blocchi':
        selezione = 1;
        break;
    case '#pannello-tradizionali':
        selezione = 1;
        break;
    case '#pannello-blocchi-cavi':
        selezione = 1;
        break;
    case '#pannello-muro-antico':
        selezione = 1;
        break;
    case '#pannello-muri':
        selezione = 2;
        break;
    case '#pannello-applicazioni':
        selezione = 2;
        break;
    case '#pannello-progettisti':
        selezione = 3;
        break;
        
    default:
        selezione = 0;
    }
    jQuery("#scheda-prodotti, #scheda-pavimentazioni, #scheda-muri, #scheda-blocchi").idTabs(function (id, list, set) {
        jQuery("a", set).removeClass("selected").addClass("bassa-opacita").css('opacity', 0.3).filter("[href='" + id + "']", set).addClass("selected").removeClass("bassa-opacita").css('opacity', 1);
        for (i in list) jQuery(list[i]).hide();
        jQuery(id).fadeIn();
    },
    true, selezione || 0);
});

/*
plugin: 
goal:  le linee vanno al posto giusto
affect: main menu
*/

jQuery(document).ready(function ($) {
    $('.page-item-104 > a, .page-item-116 > a, .page-item-123 > a, .page-item-1425 > a, .page-item-179 > a').click(function (event) {
        event.preventDefault();
    });
});

/*
plugin: hoverIntent
goal: hoverIntent is a plug-in that attempts to determine the user's intent
affect: main menu
*/

jQuery(document).ready(function () {
    jQuery("#global-list li").hoverIntent({
        sensitivity: 5,
        interval: 200,
        over: makeTall,
        timeout: 300,
        out: makeShort
    });
});

function makeTall() {
    jQuery(this).addClass("sfhover");
}

function makeShort() {
    jQuery(this).removeClass("sfhover");
}

/*
plugin: hoverIntent
goal: hoverIntent is a plug-in that attempts to determine the user's intent
affect: main menu
*/

jQuery(document).ready(function () {
    jQuery("#ferraribk-menu-alto li").hover(function () {
        jQuery("ul", this).fadeIn("fast");
    },


    function () {});
    if (document.all) {
        jQuery("#ferraribk-menu-alto li").hoverClass("sfhover");
    }
});
jQuery.fn.hoverClass = function (c) {
    return this.each(function () {
        jQuery(this).hover(function () {
            jQuery(this).addClass(c);
        },


        function () {
            jQuery(this).removeClass(c);
        });
    });
};

/*
plugin: 
goal: fake the first-child pseudo-selector for IE6
affect: main menu
*/

jQuery(document).ready(function () {
    jQuery('#ferraribk-menu-alto li.page_item > a').addClass('first');
    jQuery('#ferraribk-menu-alto li ul li a').removeClass('first');
});

/*
plugin: 
goal:fake the :hover pseudo-selector for IE6
affect: main menu
*/

jQuery(document).ready(function () {
    jQuery('#ferraribk-menu-alto .page_item > a , #ferraribk-menu-alto #global-list .page_item.current_page_item > a ').hover(function () {
        jQuery(this).addClass('xhover');
    },


    function () {
        jQuery(this).removeClass('xhover');
    });
});

/*
plugin: 
goal:move the wiewport of browser
affect: browser
*/
jQuery(document).ready(function ($) {
    $(".back-top").click(function () {
        $.scrollTo('#ferraribk-header', {
            duration: 800
        })
    });
});

/*
plugin: 
goal: quando clicco sui seguenti ID la pagina si sposta dolcemente verso il basso consentendo di focalizzare l'attenzione
affect: tabs

jQuery(document).ready(function($) {

   $("#testata-pavimentazioni a, #testata-pavimentazioni div, #testata-pavimentazioni img, #testata-blocchi a, #testata-blocchi div, #testata-blocchi img, #testata-muri a, #testata-muri div, #testata-muri img, #testata-progettisti a, #testata-progettisti div, #testata-progettisti img, #scheda-pavimentazioni a > *, #scheda-muri a > *, #scheda-blocchi a > *").click(function() {

      $.scrollTo(50, {
         duration : 300, easing : 'swing', queue : true, axis : 'xy' }
      ) }
   ); }
);

*/
/*
plugin: 
goal: tabs motivazionale
affect: tabs
*/

jQuery(document).ready(function ($) {

    $("#nav-motivazionale").idTabs(function (id, list, set) {
        $("a", set).removeClass("selected").filter("[href='" + id + "']", set).addClass("selected");
        for (i in list) $(list[i]).hide();
        $(id).fadeIn();
        return false;
    });
});

/*
plugin: 
goal: accordion in homepage
affect: accordion
*/

jQuery(document).ready(function ($) {
    $('.pan-laterale .acc_first').slideDown(500); //slides the element with class "menu_body" when mouse is over the paragraph
    $(".pan-laterale h3.pan-head").mouseover(function () {
        $(this).next("div.menu_body").slideDown(500).siblings("div.menu_body").slideUp("slow");
    });
});

/*
plugin: 
goal: ?
affect: ?
*/

jQuery(document).ready(function ($) {
    // initialize scrollable together with the navigator plugin
    $("#browsable").scrollable().navigator();
});