function slideSwitch() {
    var $active = $('#slideshow IMG.active');

    if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

    var $next =  $active.next().length ? $active.next()
        : $('#slideshow IMG:first');

    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1000, function() {
            $active.removeClass('active last-active');
        });	

}

function use_fixed(){
	var isMSIE = /MSIE 6/i.test(navigator.userAgent);

	if(isMSIE) return false;
	
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} 
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} 
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	return myHeight > 685;
}
function set_fixed() {
	document.getElementById('div_main_menu').style.position = use_fixed() ? 'fixed' : 'absolute';
}
window.onresize = set_fixed;

	
		
$(document).ready(function() {
	    
	$(".box_servizi").hide();
	$(function() {
		setInterval( "slideSwitch()", 8000 );
	});
	
	//$(".div_box_evidenza_homepage").css({opacity: 0});
	//$(".div_box_evidenza_homepage").animate({opacity: 0}, 800 ).animate({opacity: 1,}, 800 );
	
	$(".div_header_menu").css({opacity: 0.8});
	$(".div_header_menu_cont").css({opacity: 0.6});
	
	$(".div_header_menu_cont_homepage,.div_header_menu_homepage").css({opacity: 0.0});
	//$(".div_main_menu_homepage").animate({opacity: 0}, 200 ).animate({opacity: 1}, 800 );
	$(".div_header_menu_homepage").animate({opacity: 0.0}, 100 ).animate({opacity: 0.8}, 1000 );
	$(".div_header_menu_cont_homepage").animate({opacity: 0.0}, 100 ).animate({opacity: 0.6}, 1000 );

});	
