function ricarica_url(){
	//alert(url);
	self.location.reload();
}

function rimuovi_valore(valore){
	$('#'+valore).val('');
}



$(document).ready(function() {
	//tab box news
	$("#container_tab .tab_container").hide(); //Hide all content
	
	$("ul#tab_news li:first").addClass("active").show(); //Activate first tab
	$("#container_tab .tab_container:first").show(); //Show first tab content
	
$("ul#tab_news li").click(function(el) {
		//$("ul#tab_club li").removeClass(); //Remove any "active" class
		var activeTab = $(this).find("a").attr("rel"); //Find the rel attribute value to identify the active tab + content
		
        
        if (activeTab=="#tab1"){
		 $("ul#tab_news li").removeClass(); //Remove any "active" class	
		
		  $("ul#tab_news li:last").addClass("active_2"); 
		   $(this).addClass("active_1_sel").addClass("active"); //Add "active" class to selected tab
		}else{
		 $("ul#tab_news li").removeClass(); //Remove any "active" class
		 
		  $("ul#tab_news li:first").addClass("active_1");
		    $(this).addClass("active_2_sel").addClass("active"); //Add "active" class to selected tab
		}
		$("#container_tab .tab_container").slideUp(); //Hide all tab content
		
		//alert(activeTab);
		$("#container_tab "+activeTab).slideDown('slow'); //Fade in the active content
		return false;
	});


    $('.return_top').click(function (){
        $('html, body').stop().animate({scrollTop : 0},500);
    })	
    
    //accordion
    $('.acc_container').hide(); //Hide/close all containers
    //$('.acc_titolo:first').addClass('active').next().show(); //Add "active" class to first trigger, then show/open the immediate next container
    
    //On Click
    $('.acc_titolo').click(function(){
    	if( $(this).next().is(':hidden') ) { //If immediate next container is closed...
    		$('.acc_titolo').removeClass('active').next().slideUp(); //Remove all "active" state and slide up the immediate next container
    		$(this).toggleClass('active').next().slideDown(); //Add "active" state to clicked trigger and slide down the immediate next container
    	}
    	return false; //Prevent the browser jump to the link anchor
    });

    
    $('#form_login').submit(function(){
		$('#controllo_log').html('<img src="immagini/ajax_loader.gif" alt="waiting.." />');
		var risultato = $.ajax({
			type: "POST",
			async: false,
			url: 'file_ajax/login.php',
			data: ({user : $('#email_login').val(),pass :$('#password_login').val()}),
			success: function(data,textStatus){
				$('#controllo_log').html('').hide();
				$('#controllo_log').fadeIn('slow').html(data);
				if (data!="Email o password errati"){
                 setTimeout(ricarica_url,2000);
                 }
			}
		});
	   return false;
	});
    
});
	
