$(document).ready(function(){ 
	$(function() {
		//$("#googlemaps").tabs({ selected: 1 });
	
	});
   $("#pikame").PikaChoose(); 
	//$("#inner_nav").tabs({ initialIndex: 2 }); 
    $("#inner_nav").tabs({initialIndex: 2});


    $(".sound").jmp3({
			filepath: "mp3/",
			backcolor: "f3f2e9",
			forecolor: "b20801",
			width: 100,
			showdownload: "true",
			showfilename: "false",
			repeat: "false",
			volume: "80",
			autoplay: "false"
		});
   
   $(".sound_emergenze").jmp3({
			filepath: "http://www.alberodellavita.org/uploads/files/",
			backcolor: "f3f2e9",
			forecolor: "b20801",
			width: 100,
			showdownload: "true",
			showfilename: "false",
			repeat: "false",
			volume: "80",
			autoplay: "false"
		});


		$("#faq").accordion({
			header: "h3",
			alwaysOpen: false,
			autoHeight: false
		});

        /*
		$("#cerco_famiglia").accordion({
			header: "h3",
			active: 3,
			alwaysOpen: false,
			autoHeight: false
		}); 
        */  
        $("#contacts").accordion({
			header: "h3",
			active: 2,
			alwaysOpen: false,
			autoHeight: false
		});  

$("#news_elenco").accordion({
			header: "h3",
			active: 50,
			alwaysOpen: false,
			autoHeight: false
		});  

   window.fbAsyncInit = function() {
        FB.init({appId: '133521176678371', status: true, cookie: true,
                 xfbml: true});
      };
      (function() {
        var e = document.createElement('script');
        e.type = 'text/javascript';
        e.src = document.location.protocol +
          '//connect.facebook.net/it_IT/all.js';
        e.async = true;
        document.getElementById('fb-root').appendChild(e);
      }());
        


	$(function() {
		$(".download").click(function() {
			$("> :eq(0)", ".attachmentsList").toggle("blind");
		});
	});
   $(document).pngFix(); 
	// home page slide show
	function onAfter() { 
    /*$('.linkTo').html("") .append('<a href="index.php?m=progetti">' + this.alt + '</a>'); */
	$('.linkTo').html("") .append(this.alt); 
	}
    if(document.getElementById('slideshow')){
	    $('#slideshow').before('<div id="pager">').cycle({ 
           // fx:     'Fade', 
            speed:  'slow', 
            timeout: 8000 , 
	        pager:  '#pager',
			next:   '#next', 
			after:   onAfter,
   			prev:   '#prev' 
       }); 
	}

	
$("#contributor").validate();
$(".contributor_faq").validate();
$("#search").validate();
$("#newsletter-form form").validate();

/*
$('a.bazar').tooltip({ 
    track: true, 
    delay: 0, 
    showURL: false, 
    showBody: " - ", 
    fade: 250 
});
*/
    jQuery('#photogallery ul').jcarousel();


 }); 





window.onload=intercetta;
function intercetta() {
for (var i=0; i<document.links.length; i++)
if(document.links[i].rel=="blank"){
document.links[i].target="_blank";
}
}
