// The Trigger
jQuery(document).ready(function(){
jQuery("ul.trigger").click(function(){
jQuery(this).toggleClass("active").next().slideToggle("slow");
});
});

jQuery(document).ready(function() { 
        $('ul.top-menu').superfish({ 
            delay:       2000,                            // one second delay on mouseout 
            animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
            speed:       'normal',                          // faster animation speed 
            autoArrows:  true,                           // disable generation of arrow mark-up 
            dropShadows: true                            // disable drop shadows 
        }); 
    }); 

jQuery(document).ready(function(){
$("a[rel^='prettyPhoto']").prettyPhoto({theme:'dark_rounded'});


		});

jQuery(document).ready(function(){
	$("a[rel^='prettyPhoto']").each(function() {	
		var $image = $(this).contents("img");
			$hoverclass = 'hover_video';

	if($(this).attr('href').match(/(jpg|gif|jpeg|png|tif)/)) 
	$hoverclass = 'hover_image';
		
	if ($image.length > 0)
	{	
		var $hoverbg = $("<span class='"+$hoverclass+"'></span>").appendTo($(this));
		
			$(this).bind('mouseenter', function(){
			$height = $image.height();
			$width = $image.width();
			$pos =  $image.position();		
			$hoverbg.css({height:$height, width:$width, top:$pos.top, left:$pos.left});
		});
	}

});	

$("a[rel^='prettyPhoto']").contents("img").hover(function() {
		$(this).stop().animate({"opacity": "0.2"}, 400); // hover fade
		},function() {
		$(this).stop().animate({"opacity": "1"},400);
	});

$("a[rel^='home_img']").contents("img").hover(function() {
		$(this).stop().animate({"opacity": "0.2"}, 400); // hover fade
		},function() {
		$(this).stop().animate({"opacity": "1"},400);
	});	
	
});

jQuery(document).ready(function(){
//Hide (Collapse) the toggle containers on load
	jQuery(".toggle_content").hide(); 

	//Switch the "Open" and "Close" state per click
	jQuery("h3.toggle").toggle(function(){
		jQuery(this).addClass("active");
		}, function () {
		jQuery(this).removeClass("active");
	});

	//Slide up and down on click
	jQuery("h3.toggle").click(function(){
		jQuery(this).next(".toggle_content").slideToggle();
	});
	});

jQuery(document).ready(function()
{
	// Hide all the tooltips
	jQuery("#jquery li").each(function() {
		jQuery("a strong", this).css("opacity", "0");
	});
	
	jQuery("#jquery li").hover(function() { // Mouse over
		jQuery(this)
			.stop().fadeTo(500, 1)
			.siblings().stop().fadeTo(500, 0.2);
			
		jQuery("a strong", this)
			.stop()
			.animate({
				opacity: 1,
				top: "-10px"
			}, 300);
		
	}, function() { // Mouse out
		jQuery(this)
			.stop().fadeTo(500, 1)
			.siblings().stop().fadeTo(500, 1);
			
		jQuery("a strong", this)
			.stop()
			.animate({
				opacity: 0,
				top: "-1px"
			}, 300);
	});
	
});

jQuery(document).ready(function()
{
	// Hide all the tooltips
	jQuery("#toggle li").each(function() {
		jQuery("a strong", this).css("opacity", "0");
	});
	
	jQuery("#toggle li").hover(function() { // Mouse over
		jQuery(this)
			.stop().fadeTo(500, 1)
			.siblings().stop().fadeTo(500, 0.2);
			
		jQuery("a strong", this)
			.stop()
			.animate({
				opacity: 1,
				top: "-10px"
			}, 300);
		
	}, function() { // Mouse out
		jQuery(this)
			.stop().fadeTo(500, 1)
			.siblings().stop().fadeTo(500, 1);
			
		jQuery("a strong", this)
			.stop()
			.animate({
				opacity: 0,
				top: "-1px"
			}, 300);
	});
	
});

jQuery(document).ready(function(){
						   
	jQuery("div#content.g640 ul.display li").click(function(){
    	window.location=$(this).find("a.expand").attr("href");return false;
	});

}); //close doc ready


	// box-light hover effect
        jQuery(document).ready(function($){
                $("div#content.g640 ul.display li").hover(function() {				
                $(this).stop().animate({ backgroundColor: "#f1f1f1" }, 400);
        },function() {
                 $(this).stop().animate({ backgroundColor: "#fff" }, 500);
        });
  });

	
jQuery(document).ready(function($){
	var ww = $(window).width();
	if (ww < 1000) {
					$('#top.g540').css({'float':'left'})
					$('ul.top-menu').css({'float':'left'});              
					}  
			});	
jQuery(window).load(function() {
$('#featured').orbit({
     animation: 'fade',                  // fade, horizontal-slide, vertical-slide, horizontal-push
     animationSpeed: 300,                // how fast animtions are
     timer: true, 			 // true or false to have the timer
     advanceSpeed: 5000, 		 // if timer is enabled, time between transitions 
     pauseOnHover: false, 		 // if you hover pauses the slider
     startClockOnMouseOut: false, 	 // if clock should start on MouseOut
     startClockOnMouseOutAfter: 1000, 	 // how long after MouseOut should the timer start again
     directionalNav: false, 		 // manual advancing directional navs
     captions: true, 			 // do you want captions?
     captionAnimation: 'fade', 		 // fade, slideOpen, none
     captionAnimationSpeed: 800, 	 // if so how quickly should they animate in
     bullets: false,			 // true or false to activate the bullet navigation
     bulletThumbs: false,		 // thumbnails for the bullets
     bulletThumbLocation: '',		 // location from this file where thumbs will be
     afterSlideChange: function(){} 	 // empty function 
});});

$(document).ready(function(){
 
	$(".avanzata").click(function(){
		$("#advanced_hidden").slideToggle("slow");
                return false;
	});
	
	 
});

			var list1 = [
				{'When':'Articolo','Value':'3','Text':'Servizi'},
				{'When':'Articolo','Value':'4','Text':'Dossier'},
				{'When':'Articolo','Value':'5','Text':'Notizie'},
				{'When':'Articolo','Value':'6','Text':'AnciToscana'},
				{'When':'Persona','Value':'2','Text':'Comune'},
				{'When':'Persona','Value':'6','Text':'AnciToscana'},
				{'When':'DocumentoAllegato','Value':'3','Text':'Servizi'},
				{'When':'DocumentoAllegato','Value':'4','Text':'Dossier'},
				{'When':'DocumentoAllegato','Value':'5','Text':'Notizie'},
				{'When':'DocumentoAllegato','Value':'141','Text':'Comunicati Stampa'},
				{'When':'DocumentoAllegato','Value':'6','Text':'AnciToscana'},
				{'When':'Comune','Value':'165','Text':'Arezzo'},
				{'When':'Comune','Value':'166','Text':'Firenze'},
				{'When':'Comune','Value':'186','Text':'Grosseto'},
				{'When':'Comune','Value':'187','Text':'Livorno'},
				{'When':'Comune','Value':'188','Text':'Lucca'},
				{'When':'Comune','Value':'189','Text':'Massa Carrara'},
				{'When':'Comune','Value':'190','Text':'Pisa'},
				{'When':'Comune','Value':'191','Text':'Pistoia'},
				{'When':'Comune','Value':'192','Text':'Prato'},
				{'When':'Comune','Value':'193','Text':'Siena'}
				];
			
			function commonTemplate(item) {
				return "<option value='" + item.Value + "'>" + item.Text + "</option>"; 
			};
			function commonTemplate2(item) {
				return "<option value='" + item.Value + "'>***" + item.Text + "***</option>"; 
			};
			
			function commonMatch(selectedValue) {
				return this.When == selectedValue; 
			};
  function PrintElem(elem)
    {
		var total= $('.content_article').html();
		Popup(total);

    }



    function Popup(data) 
    {
        var mywindow = window.open('', 'Stampa', 'height=400,width=600,scrollbars');
        mywindow.document.write('<html><head><title>Anteprima di stampa</title>');
	mywindow.document.write('<link rel="stylesheet" href="http://www.ancitoscana.it/template/css/style.css" type="text/css" />');
	mywindow.document.write('<link rel="stylesheet" href="http://www.ancitoscana.it/template/css/style2.css" type="text/css" />');
        mywindow.document.write('</head><body >');
        mywindow.document.write('<div><img src="http://www.ancitoscana.it/template/images/logo-ancitoscana.jpg" width="70px" height="70px" /><br /><br /></div>');
        mywindow.document.write(data);
        mywindow.document.write('<div>fonte: <a href="http://www.ancitoscana.it">www.ancitoscana.it</a></div>');
        mywindow.document.write('</body></html>');
        mywindow.document.close();
        mywindow.print();
        return true;
    }

