/***************************************************
MENU
***************************************************/

$(document).ready(function () {
 	$('#t_solutions').click(function () {
 	$('#m_solutions').slideToggle('medium');
 	$('#m_products').hide('medium');
 	});
});

$(document).ready(function () {
 	$('#t_products').click(function () {
 	$('#m_products').slideToggle('medium');
 	$('#m_solutions').hide('medium');
 	});
});

$(document).ready(function () {
 	$('#t_genera').click(function () {
 	$('#genera').slideToggle('medium');
 	$('#scarica').hide('medium');
 	});
});

$(document).ready(function () {
 	$('#t_scarica').click(function () {
 	$('#scarica').slideToggle('medium');
 	$('#genera').hide('medium');
 	});
});


/***************************************************
TAB BLOG
***************************************************/

$(document).ready(function() {

    //Default Action
    $(".tab_content").hide(); //Hide all content
    $("ul.tabs li:first").addClass("active").show(); //Activate first tab
    $(".tab_content:first").show(); //Show first tab content
    
    //On Click Event
    $("ul.tabs li").click(function() {
        $("ul.tabs li").removeClass("active"); //Remove any "active" class
        $(this).addClass("active"); //Add "active" class to selected tab
        $(".tab_content").hide(); //Hide all tab content
        var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
        $(activeTab).fadeIn(); //Fade in the active content
        return false;
    });

});

/***************************************************
SOCIAL ICON
***************************************************/

$(document).ready(function()
{
    // Hide all the tooltips
    $("#jquery li").each(function() {
        $("a strong", this).css("opacity", "0");
    });
    
    $("#jquery li").hover(function() { // Mouse over
        $(this)
            .stop().fadeTo(500, 1)
            .siblings().stop().fadeTo(500, 0.2);
            
        $("a strong", this)
            .stop()
            .animate({
                opacity: 1,
                top: "-20px"
            }, 300);
        
    }, function() { // Mouse out
        $(this)
            .stop().fadeTo(500, 1)
            .siblings().stop().fadeTo(500, 1);
            
        $("a strong", this)
            .stop()
            .animate({
                opacity: 0,
                top: "-1px"
            }, 300);
    });
    
});


/***************************************************
PORTFOLIO FILTERABLE
***************************************************/
/*
* Copyright (C) 2009 Joel Sutherland.
* Liscenced under the MIT liscense
*/
(function($) {
    $.fn.filterable = function(settings) {
        settings = $.extend({
            useHash: true,
            animationSpeed: 800,
            show: { width: 'show', opacity: 'show' },
            hide: { width: 'hide', opacity: 'hide' },
            useTags: true,
            tagSelector: '#portfolio-filter a',
            selectedTagClass: 'current',
            allTag: 'all'
        }, settings);

        return $(this).each(function() {

            /* FILTER: select a tag and filter */
            $(this).bind("filter", function(e, tagToShow) {
                if (settings.useTags) {
                    $(settings.tagSelector).removeClass(settings.selectedTagClass);
                    $(settings.tagSelector + '[href=' + tagToShow + ']').addClass(settings.selectedTagClass);
                }
                $(this).trigger("filterportfolio", [tagToShow.substr(1)]);
            });

            /* FILTERPORTFOLIO: pass in a class to show, all others will be hidden */
            $(this).bind("filterportfolio", function(e, classToShow) {
                if (classToShow == settings.allTag) {
                    $(this).trigger("show");
                } else {
                    $(this).trigger("show", ['.' + classToShow]);
                    $(this).trigger("hide", [':not(.' + classToShow + ')']);
                }
                if (settings.useHash) {
                    location.hash = '#' + classToShow;
                }
            });

            /* SHOW: show a single class*/
            $(this).bind("show", function(e, selectorToShow) {
                $(this).children(selectorToShow).animate(settings.show, settings.animationSpeed);
            });

            /* SHOW: hide a single class*/
            $(this).bind("hide", function(e, selectorToHide) {
                $(this).children(selectorToHide).animate(settings.hide, settings.animationSpeed);
            });

            /* ============ Check URL Hash ====================*/
            if (settings.useHash) {
                if (location.hash != '')
                    $(this).trigger("filter", [location.hash]);
                else
                    $(this).trigger("filter", ['#' + settings.allTag]);
            }

            /* ============ Setup Tags ====================*/
            if (settings.useTags) {
                $(settings.tagSelector).click(function() {
                    $('.column ul').trigger("filter", [$(this).attr('href')]);
                    $('.column-list ul').trigger("filter", [$(this).attr('href')]);
                    $(settings.tagSelector).removeClass('current');
                    $(this).addClass('current');
                });
            }
        });
    }
})(jQuery);

$(document).ready(function() {
    $('.column ul').filterable();
    $('.column-list ul').filterable();
});




