  var directionDisplay;
  var directionsService = new google.maps.DirectionsService();
  var map;

  function initialize() {
    directionsDisplay = new google.maps.DirectionsRenderer();
    var roma = new google.maps.LatLng(41.829741,12.393268);
    var myOptions = {
      zoom : 11,
      mapTypeId : google.maps.MapTypeId.ROADMAP,
      center : roma
    }
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    directionsDisplay.setMap(map);
    
	 var marker = new google.maps.Marker({
      map: map,
      position: roma
  	 });
  	 
  }
  
  function calcRoute() {
    var start = document.getElementById("start").value;
    var end = "Via Colonnello Tommaso Masala, 54 00148 Roma (RM)";
    var request = {
        origin : start , 
        destination : end ,
        travelMode : google.maps.DirectionsTravelMode.DRIVING
    };
    directionsService.route(request, function(response, status) {
      if (status == google.maps.DirectionsStatus.OK) {
        directionsDisplay.setDirections(response);
      }
    });
  }

$(document).ready(function() {

/*
	var myLatlng = new google.maps.LatLng(41.899466,12.508278);
	var myOptions = {
		zoom:11,
  		center: myLatlng,
  		disableDefaultUI: true,
  		navigationControl: true,
  		navigationControlOptions: { style: google.maps.NavigationControlStyle.ZOOM_PAN },
  		mapTypeControl: true,
    	mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DROPDOWN_MENU },
		mapTypeId: google.maps.MapTypeId.ROADMAP
	};

	var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
	map.setCenter(myLatlng);
	
	var marker = new google.maps.Marker({
      map: map,
      position: myLatlng
  });
  
*/ 

	
	


	/** ***** **** *** 
		SCRIPT ASSEMBLEA COSTITUENTE
	************* *** */
	
	
/*
       var map = new GMap2(document.getElementById("map_canvas"));

        map.setCenter(new GLatLng(41.899466,12.508278), 11);
        var customUI = map.getDefaultUI();
        // Remove MapType.G_HYBRID_MAP
        customUI.maptypes.hybrid = false;
        map.setUI(customUI);
*/
	var winWidth = $(window).width();
	var winHeight = $(window).height();
	
	$('#fixfooter').css({left: ((winWidth-980)/2)+'px', right: ((winWidth-980)/2)+'px'});	
	
	$('body').width(winWidth + 'px');
	$('body').height(winHeight + 'px');
	
	var bodyWidth = $('body').width() - 980;
	var curPagina = "pagina_home";
	
	var leftStop = (winWidth - 980)/2;

	var costTimeAuto = setTimeout(function() {
		
		$('#auto').animate({right: '1280px'}, 3000, function() {
			$(this).css({right: '-450px'});
		});
		$('#fune').animate({right: '1080px'}, 3000, function() {
			$(this).hide().css({right: '-630px'}).show();
		});
		$('#pagina_home').animate({left: leftStop + 'px'}, 3200, function() {
			$('#siteback').animate({'marginTop': '10px'}, {easing: 'easeOutBounce', duration: 500});
		});
		
	}, 2500);


	$(".button_home").click(function() {

		$('#siteback').animate({'marginTop': '50px'}, {easing: 'easeOutBounce', duration: 500});

		$("#" + curPagina ).animate({top: '-500px'}, 500, function() {
		
			$('#auto').animate({right: '1280px'}, 3000, function() {
				$(this).css({right: '-450px'});
			});

			$('#fune').animate({right: '1080px'}, 3000, function() {
				$(this).hide().css({right: '-630px'}).show();
			});
			
			$('.pagina').css({top: 'auto', left: '1800px', right: 'auto', bottom: '70px'});
			$('#pagina_home').animate({left: leftStop +'px'}, 3200, function() { 
				curPagina = "pagina_home";
				$('#siteback').animate({'marginTop': '10px'}, {easing: 'easeOutBounce', duration: 500});
			});
			
		});
	});

	$(".button_1").click(function() {
		
		$('#siteback').animate({'marginTop': '50px'}, {easing: 'easeOutBounce', duration: 500});
		$("#" + curPagina ).animate({top: '-500px'}, 500, function() {
			$('#auto').animate({right: '1280px'}, 3000, function() {
				$(this).css({right: '-450px'});
			});
			$('#fune').animate({right: '1080px'}, 3000, function() {
				$(this).hide().css({right: '-630px'}).show();
			});
			$('.pagina').css({top: 'auto', left: '1800px', right: 'auto', bottom: '70px'});
			$('#pagina1').animate({left: leftStop +'px'}, 3200, function() { 
				curPagina = "pagina1";
				$('#siteback').animate({'marginTop': '10px'}, {easing: 'easeOutBounce', duration: 500});
			});
		});
	});

	$(".button_2").click(function() {
		
		$('#siteback').animate({'marginTop': '50px'}, {easing: 'easeOutBounce', duration: 500});
		$("#" + curPagina ).animate({top: '-500px'}, 500, function() {
			$('#auto').animate({right: '1280px'}, 3000, function() {
				$(this).css({right: '-450px'});
			});
			$('#fune').animate({right: '1080px'}, 3000, function() {
				$(this).hide().css({right: '-630px'}).show();
			});
			$('.pagina').css({top: 'auto', left: '1800px', right: 'auto', bottom: '70px'});
			$('#pagina2').animate({left: leftStop +'px'}, 3200, function() { 
				curPagina = "pagina2";
				$('#siteback').animate({'marginTop': '10px'}, {easing: 'easeOutBounce', duration: 500});
			});
		});
	});

	$(".button_3").click(function() {
		
		$('#siteback').animate({'marginTop': '50px'}, {easing: 'easeOutBounce', duration: 500});
		$("#" + curPagina ).animate({top: '-500px'}, 500, function() {
			$('#auto').animate({right: '1280px'}, 3000, function() {
				$(this).css({right: '-450px'});
			});
			$('#fune').animate({right: '1080px'}, 3000, function() {
				$(this).fadeOut(1000, function() {
					$(this).fadeIn(10).css({right: '-630px'});
				});
			});
			$('.pagina').css({top: 'auto', left: '1800px', right: 'auto', bottom: '70px'});
			$('#pagina3').animate({left: leftStop +'px'}, 3200, function() { 
				curPagina = "pagina3";
				$('#siteback').animate({'marginTop': '10px'}, {easing: 'easeOutBounce', duration: 500});
			});
		});
	});


	$(".button_4").click(function() {
		
		$('#siteback').animate({'marginTop': '50px'}, {easing: 'easeOutBounce', duration: 500});
		$("#" + curPagina ).animate({top: '-500px'}, 500, function() {
			$('#auto').animate({right: '1280px'}, 3000, function() {
				$(this).css({right: '-450px'});
			});
			$('#fune').animate({right: '1080px'}, 3000, function() {
				$(this).hide().css({right: '-630px'}).show();
			});
			$('.pagina').css({top: 'auto', left: '1800px', right: 'auto', bottom: '70px'});
			$('#pagina4').animate({left: leftStop +'px'}, 3200, function() { 
				curPagina = "pagina4";
				$('#siteback').animate({'marginTop': '10px'}, {easing: 'easeOutBounce', duration: 500});
			});
		});
	});


	$(".button_5").click(function() {

		$('#siteback').animate({'marginTop': '50px'}, {easing: 'easeOutBounce', duration: 500});
		$("#" + curPagina ).animate({top: '-500px'}, 500, function() {
			$('#auto').animate({right: '1280px'}, 3000, function() {
				$(this).css({right: '-450px'});
			});
			$('#fune').animate({right: '1080px'}, 3000, function() {
				$(this).hide().css({right: '-630px'}).show();
			});
			$('.pagina').css({top: 'auto', left: '1800px', right: 'auto', bottom: '70px'});
			$('#pagina5').animate({left: leftStop +'px'}, 3200, function() { 
				curPagina = "pagina5";
				$('#siteback').animate({'marginTop': '10px'}, {easing: 'easeOutBounce', duration: 500});
			});
		});
	});


	$(".button_6").click(function() {

		$('#siteback').animate({'marginTop': '50px'}, {easing: 'easeOutBounce', duration: 500});
		$("#" + curPagina ).animate({top: '-500px'}, 500, function() {
			
			$('#auto').animate({right: '1280px'}, 3000, function() {
				$(this).css({right: '-450px'});
			});
			$('#fune').animate({right: '1080px'}, 3000, function() {
				$(this).hide().css({right: '-630px'}).show();
			});
			$('.pagina').css({top: 'auto', left: '1800px', right: 'auto', bottom: '70px'});
			$('#pagina6').animate({left: leftStop +'px'}, 3200, function() { 
				curPagina = "pagina6";
				$('#siteback').animate({'marginTop': '10px'}, {easing: 'easeOutBounce', duration: 500});
			});
		});
	});




	/* ***************************************************** */

	
});
