var help = 0;
var active_section = 0;
var active_scheda = '';

jQuery(window).bind("load", function(){
	
});

function switchHelp() {
        if(help==0) {
                $('#help_box').fadeIn('slow', function() {
                        // Animation complete
                        help = 1;
                });
        } else {
                $('#help_box').fadeOut('slow', function() {
                        // Animation complete
                        help = 0;
                });
        }
}

function selectSezione(sezione) {
        if(sezione != active_section) {
                //alert(active_section);
                if(active_section > 0) {
                        $('#notes_basso_' + active_section).fadeOut('slow', function() {
                                openSezione(sezione);
                        });
                } else {
                        openSezione(sezione);
                }
        }
}

function openSezione(sezione) {
        //alert('dentro open');
        $('#notes_basso_' + sezione).fadeIn('slow', function() {
                // Animation complete
                active_section = sezione;
        });
}

function switchSchedaDescrizione(id, blocco) {
        id_scheda = "#scheda_descrizione_" + id + "_" + blocco;
        //alert(id_scheda + ' ' );
	if(id_scheda != active_scheda) {
            //alert(active_section);
            if(active_scheda != '') {
                $(active_scheda).slideUp("slow", function() {
                    openSchedaDescrizione(id_scheda);
                });
            } else {
                    openSchedaDescrizione(id_scheda);
            }
	} else {
            $(id_scheda).slideUp("slow", function() {
                active_scheda = '';
            });
        }
}

function openSchedaDescrizione(id_scheda) {
	$(id_scheda).slideDown("slow", function() {
		active_scheda = id_scheda;
	});
}
/*
$(function() {
	$('a.lightbox').lightBox(); // Select all links with lightbox class
});
*/

$(document).ready(function(){
    $("a[rel^='prettyPhoto']").prettyPhoto({
                    animation_speed: 'fast', /* fast/slow/normal */
                    slideshow: false, /* false OR interval time in ms */
                    autoplay_slideshow: false, /* true/false */
                    opacity: 0.40, /* Value between 0 and 1 */
                    show_title: false, /* true/false */
                    allow_resize: false, /* Resize the photos bigger than viewport. true/false */
                    default_width: 500,
                    default_height: 344,
                    counter_separator_label: ' di ', /* The separator for the gallery counter 1 "of" 2 */
                    theme: 'light_square', /* light_rounded / dark_rounded / light_square / dark_square / facebook */
                    hideflash: false, /* Hides all the flash object on a page, set to TRUE if flash appears over prettyPhoto */
                    wmode: 'opaque', /* Set the flash wmode attribute */
                    autoplay: true, /* Automatically start videos: True/False */
                    modal: false, /* If set to true, only the close button will close the window */
                    overlay_gallery: false, /* If set to true, a gallery will overlay the fullscreen image on mouse over */
                    keyboard_shortcuts: true /* Set to false if you open forms inside prettyPhoto */
    });
});

