// JavaScript Document
function gotosearch(path) {
        document.location.href = path + "ricerca/" + document.getElementById('s').value;
    }



    function gotoguidesearch(path) {
        if (document.getElementById('guida_field_txt').value != "") {
            document.location.href = path + "guida/ricerca/" + document.getElementById('guida_field_txt').value;
        }
    }


    function handleDropDownChanged(e) {
        var path = document.getElementById('absolute_path_txt').value;
        document.location.href = path + "guida/utenti/" + e.value;      
    }
	
	jQuery.noConflict(); if (typeof(window.$) === 'undefined') { window.$ = jQuery; } 
    jQuery(document).ready(function ($) {

        //Featured contents
        ///var speed=5000;
        ///$("#featured").tabs({fx:{opacity: "toggle", width:"toggle",duration:'fast'}}).tabs("rotate", speed, true);
        ///$(".ui-tabs-panel > a").hover(function() {$("#featured").tabs("rotate",0,true);},function() {$("#featured").tabs("rotate",6000,true);});

        // Adegua l'altezza delle celle
        $("#www_targets .right li, #www_targets .left li").equalHeights();

        // News ticker
        var first = 0;
        var speed = 700;
        var pause = 8000;
        function removeFirst() {
            first = $('ul#newsSlider li:first').html();
            $('ul#newsSlider li:first')
		.animate({ opacity: 0 }, speed)
		.fadeOut('slow', function () { $(this).remove(); });
            addLast(first);
        }

        function addLast(first) {
            last = '<li style="display:none">' + first + '</li>';
            $('ul#newsSlider').append(last)
            $('ul#newsSlider li:last')
		.animate({ opacity: 1 }, speed)
		.fadeIn('slow')
        }
        interval = setInterval(removeFirst, pause);
    });
 


jQuery(document).ready(function($) {
	// Menu onmouseover
	$("#www_nav_main ul li").hover(
        function () {
            $(this).children('div').slideToggle(10);
			$(this).children('a.nav-tab').addClass('nowElem');
        },
        function () {
            $(this).children('a.nav-tab').removeClass('nowElem');
			$(this).children('div').hide();
        }
    );

	//Pannello Slide
	$("#pannello_scomparsa").hide();
	$("#pannello_scomparsa").delay(750).slideToggle(200);
	$(".btn-slide").toggleClass("active");
	$("#pannello_scomparsa").delay(3000).slideToggle(200);
	$(".btn-slide").toggleClass("active");
	$(".btn-slide").click(function(){
	$("#pannello_scomparsa").stop().slideToggle();
	$(this).toggleClass("active");
	});
	
	//Featured
	$(function () {
	  if ($('#featured').length) 
		 {
		  if ( $('.slides_control').length==0) {
		  // Initialize Slides
		  $('#featured').slides({
			  //preload: true,
			  //preloadImage: 'img/loading.gif',
			  generatePagination: true,
			  play: 10000,
			  pause: 2500,
			  hoverPause: true,
			  fadeSpeed: 350,
			  fadeEasing: "easeOutQuad",
			  slideEasing: "easeOutQuad",
			  effect: 'fade, fade'
		  });
	   }
	   }
	});
	
	//Search
	$(function (){
		$("#s.field").click(function(){
			if (!$(this).hasClass("large")) {
			$(this).animate({
			width: 210,
			marginLeft: "-70px"
		  }, 500, function() {
			// Animation complete.
		  }).addClass('large');
			}
		}).focusout(function() {
			$(this).animate({
				width: 140,
				marginLeft: "0px"
			  }, 500, function() {
				// Animation complete.
			  }).removeClass('large');
		});	
	});
	
	//Placeholder
	
});

function AggiornaHomePage() {
    document.getElementById('www_canvas').className = "archive asidebottom";
}
// Altezza uguale degli elementi
(function($) {
	$.fn.equalHeights = function(minHeight, maxHeight) {
		tallest = (minHeight) ? minHeight : 0;
		this.each(function() {
			if($(this).height() > tallest) {
				tallest = $(this).height();
			}
		});
		if((maxHeight) && tallest > maxHeight) tallest = maxHeight;
		return this.each(function() {
			$(this).height(tallest).css("overflow","visible");
		});
	}
	
})(jQuery);
