// Funzione che governa il sistema delle schede (attiva la scheda cliccata, portando in primo piano il box corrispondente e disattiva le altre). Imposta come attiva la prima scheda al caricamento della pagina

function show_folds() {
    $('div.panel').hide();
    $('div.panel-labels li a').eq(0).attr('class','active');
    var first_field = $('div.panel').eq(0).show().find(':input').eq(0);
    if (!first_field.hasClass('readonly')) first_field.focus();
    $('div.panel-labels li a').click(function() {
        $('div.panel-labels li a').removeAttr('class');
        $(this).attr('class','active');
        var n = $('div.panel-labels li a').index(this);
        $('div.panel').hide();
        var first_field = $('div.panel').eq(n).show().find(':input').eq(0);
        if (!first_field.hasClass('readonly')) first_field.focus();
        return false;
    });
}






$(document).ready(function() {

    $('#portfolio').innerfade({
        animationtype : 'fade',
        speed : 'normal',
        timeout : 4000,
        type : 'sequence',
        containerheight : '305px'
    });

    $('.zoom').jqzoom({
        zoomType : 'reverse',
        lens : true,
        preloadImages : false,
        alwaysOn : false,
        position : 'right',
        xOffset : 10,
        zoomWidth : 300,
        zoomHeight : 300
    });

 /*   $('a.fancybox').fancybox({
		transitionIn : 'fade',
		transitionOut : 'elastic',
        centerOnScroll : true,
        titleShow : false,
        showNavArrows : false
    });*/

    $('a.mail').each(function() {
        var m = $(this).attr('href').replace('[AT]','@');
        m = m.replace('[DOT]','.');
        if ($(this).html()==$(this).attr('href').substr(7)) {
            var t = $(this).html().replace('[AT]','@');
            t = t.replace('[DOT]','.');
            $(this).html(t);
        }
        $(this).attr('href',m);
    });
	

	

	    // Attiva il sistema di funzionamento delle schede

    show_folds();

});
