
function initialize() {
var myOptions = {zoom: 10, center: new google.maps.LatLng(43.7477197,11.1716062), mapTypeId: google.maps.MapTypeId.ROADMAP}
var map = new google.maps.Map(document.getElementById("mappa"), myOptions);


var image = '/struttura/blu.png';
var myLatLng = new google.maps.LatLng(43.7477197,11.1716062);
var contentString = '<a href="/">GEOPOZZI</a><br><font size=1>Via della Prata 81/P - Scandicci (FI)</font>';
var infowindow = new google.maps.InfoWindow({content: contentString, maxWidth: 100});
var beachMarker = new google.maps.Marker({position: myLatLng, map: map, icon: image, title: 'GEOPOZZI'});
google.maps.event.addListener(beachMarker, 'click', function() {infowindow.open(map,beachMarker);});

var image2 = '/struttura/verde.png';
var myLatLng2 = new google.maps.LatLng(43.8204031,11.1355321);
var contentString2 = '<a href="/">GEOPOZZI - Sede Operativa</a><br><font size=1>Via Matteucci 17 - Calenzano (FI)</font>';
var infowindow2 = new google.maps.InfoWindow({content: contentString2, maxWidth: 100});
var beachMarker2 = new google.maps.Marker({position: myLatLng2, map: map, icon: image2, title: 'GEOPOZZI - Sede Operativa'});
google.maps.event.addListener(beachMarker2, 'click', function() {infowindow2.open(map,beachMarker2);});


}


$(function(){
$('a.fancyzoom').fancyzoom();
});

var slideshowSpeed = 6000;
var photos = [ 
{"image" : "slide-uno.jpg"},
{"image" : "slide-due.jpg"},
{"image" : "slide-tre.jpg"},
{"image" : "slide-quattro.jpg"}, 
{"image" : "slide-cinque.jpg"}
];
$(document).ready(function() {
var interval;
$("#control").toggle(function(){
stopAnimation();
}, function() {
$(this).css({ "background-image" : "url(/struttura/loading.gif)" });
navigate("next");
interval = setInterval(function() {navigate("next");}, slideshowSpeed);
});
	
	
var activeContainer = 1;	
var currentImg = 0;
var animating = false;
var navigate = function(direction) {
if(animating) {
return;
}
		
if(direction == "next") {
currentImg++;
if(currentImg == photos.length + 1) {
currentImg = 1;
}
} else {
currentImg--;
if(currentImg == 0) {
currentImg = photos.length;
}
}
		
var currentContainer = activeContainer;
if(activeContainer == 1) {
activeContainer = 2;
} else {
activeContainer = 1;
}
showImage(photos[currentImg - 1], currentContainer, activeContainer);
};
	
var currentZindex = -1;
var showImage = function(photoObject, currentContainer, activeContainer) {
animating = true;
currentZindex--;

// Set the background image of the new active container
$("#headerimg" + activeContainer).css({
"background-image" : "url(/struttura/" + photoObject.image + ")",
			"display" : "block",
			"z-index" : currentZindex
		});
		

		
		
		// Fade out the current container
		// and display the header text when animation is complete
		$("#headerimg" + currentContainer).fadeOut(function() {
			setTimeout(function() {
				$("#headertxt").css({"display" : "block"});
				animating = false;
			}, 500);
		});
	};
	

	
	// We should statically set the first image
	navigate("next");
	
	// Start playing the animation
	interval = setInterval(function() {
		navigate("next");
	}, slideshowSpeed);
	
});


