function findObj(theObj, theDoc)
{
  var p, i, foundObj;
  
  if(!theDoc) theDoc = document;
  if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
  {
    theDoc = parent.frames[theObj.substring(p+1)].document;
    theObj = theObj.substring(0,p);
  }
  if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
  for (i=0; !foundObj && i < theDoc.forms.length; i++) 
    foundObj = theDoc.forms[i][theObj];
  for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++) 
    foundObj = findObj(theObj,theDoc.layers[i].document);
  if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);
  
  return foundObj;
}
function cambia(num) {
	obj = findObj("menu");
	switch (num) {
		case 1:
		obj.innerHTML = "-&gt; &nbsp;Il Centro Francesca";
		break;
		case 2:
		obj.innerHTML = "-&gt; &nbsp;La storia del Centro Francesca";
		break;
		case 3:
		obj.innerHTML = "-&gt; &nbsp;La Cooperativa Francesca";
		break;
		case 4:
		obj.innerHTML = "-&gt; &nbsp;Scuola per tutti";
		break;
		case 5:
		obj.innerHTML = "-&gt; &nbsp;Link utili";
		break;
		case 6:
		obj.innerHTML = "-&gt; &nbsp;Come sostenerci";
		break;
		case 7:
		obj.innerHTML = "-&gt; &nbsp;Centro Studi";
		break;
		case 8:
		obj.innerHTML = "-&gt; &nbsp;Progetti";
		break;
		case 9:
		obj.innerHTML = "-&gt; &nbsp;News";
		break;
		case 10:
		obj.innerHTML = "-&gt; &nbsp;Forum";
		break;
		case 11:
		obj.innerHTML = "-&gt; &nbsp;Eventi";
		break;
		case 12:
		obj.innerHTML = "-&gt; &nbsp;Contattaci";
		break;
		case 13:
		obj.innerHTML = "-&gt; &nbsp;Come raggiungerci";
		break;
		case 14:
		obj.innerHTML = "-&gt; &nbsp;Materiale didattico";
		break;
		case 15:
		obj.innerHTML = "-&gt; &nbsp;Photo gallery";
		break;
		default:
		obj.innerHTML = "Benvenuto nel Centro Francesca. Passa il mouse sul fiore per accedere al men&ugrave; rapido.";
		break;
		
	}
}
function stampa() {
	self.print();
}
function creaTesto(titolo,corpo) {
	return "<strong>" + titolo + "</strong><br/><font size=\"1\">" + corpo + "<br/>&nbsp;</font>";
}
function loadMap(cond) {
	if (cond == true) {
      if (GBrowserIsCompatible()) {
		  
        var map = new GMap2(document.getElementById("cartina"));

		var pos = new GControlPosition(G_ANCHOR_BOTTOM_LEFT, new GSize(100,5));
		pos.apply(document.getElementById("poweredby"));
		map.getContainer().appendChild(document.getElementById("poweredby"));
	  
		map.addControl(new GLargeMapControl());
		map.addControl(new GOverviewMapControl());
		//map.addControl(new GScaleControl());
		//map.addControl(new GMapTypeControl());
		//map.addControl(new GSmallZoomControl());
		map.setCenter(new GLatLng(0,0),0);
		//map.setCenter(new GLatLng(43.73414284243448, 12.592048645019531), 11); 
		var point = new GLatLng(43.75713913608976, 12.666839361190796);
		map.addOverlay(createMarker(point, creaTesto("Servizio di avviamento al lavoro","Laboratorio - Via Urbinate 72 - 61029 - Urbino (PU)<br/>Tel 0722 322509"),1));
		bounds.extend(point);
		point = new GLatLng(43.73395678988442, 12.624127864837646);
		map.addOverlay(createMarker(point, creaTesto("Servizio di avviamento al lavoro","Piscina - Piazzale Neruda - Urbino (PU)<br/>Tel: 0722 327852"),2));
		bounds.extend(point);
		point = new GLatLng(43.71145567516355, 12.629588842391968);
		map.addOverlay(createMarker(point, creaTesto("Servizio Senior","Loc. Ca’ Messere - 61029 - Crocicchia Urbino (PU)<br/>Tel. 0722 331209 - Fax 0722 377280"),3));
		bounds.extend(point);
		point = new GLatLng(43.68581178509909, 12.64553189277649);
		map.addOverlay(createMarker(point, creaTesto("Servizio La Scuola per Tutti","Via Milano - 61033 Fermignano (PU)<br/>Tel: 0722 332648 - Fax 0722 377280"),4));
		bounds.extend(point);
		point = new GLatLng(43.669974736852005, 12.517365217208862);
		map.addOverlay(createMarker(point, creaTesto("Servizio La Scuola per Tutti","Via Dante Alighieri - 61049 - Urbania (PU)<br/>Tel. 0722 312074 - Fax 0722 377280"),5));
		bounds.extend(point);
		
		point = new GLatLng(43.7267390552624, 12.636959552764893);
		var titolo1 = "Ricerca";
		var testo1 = creaTesto("Centro di Ricerca, Documentazione e Informazione sull'Handicap","Via Pozzo Nuovo, 6 - 61029 - Urbino (PU)<br/>Tel. 0722 329701 - Fax 0722 377280");
		var titolo2 = "Genitori";
		var testo2 = creaTesto("Servizio di Formazione dei genitori","Via Pozzo Nuovo, 6 - 61029 - Urbino (PU)<br/>Tel. 0722 329701 - Fax 0722 377280");
		var titolo3 = "Scuola";
		var testo3 = creaTesto("Servizio La Scuola per Tutti","Via Pozzo Nuovo, 6 - 61029 - Urbino (PU)<br/>Tel. 0722 329701 - Fax 0722 377280");
		var marker = createTabbedMarker(point, [testo1, testo2, testo3],[titolo1,titolo2,titolo3],6);
		map.addOverlay(marker);
		bounds.extend(point);

		point = new GLatLng(43.72670804271074, 12.635082006454468);
		map.addOverlay(createMarker(point, creaTesto("Servizio Socio Educativo","Via S. Margherita - 61029 Urbino (PU)<br/>Tel. 0722 331209 - 320549<br/>Fax 0722 377280"),7));
		bounds.extend(point);
		
		map.setZoom(map.getBoundsZoomLevel(bounds));
		map.setCenter(bounds.getCenter());
		
      } else {
		  alert("Le mappe di google non possono essere visualizzate sul tuo browser");
	  }
	}
}
function createMarker(point, description, index) {
	var marker = new GMarker(point);
	GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(description);});
	gmarkers[index] = marker;
	return marker;
}
function createTabbedMarker(point, htmls, labels, index) {
	var marker = new GMarker(point);
	GEvent.addListener(marker, "click", function() {
	  // adjust the width so that the info window is large enough for this many tabs
	  if (htmls.length > 2) {
		htmls[0] = '<div style="width:'+htmls.length*88+'px">' + htmls[0] + '</div>';
	  }
	  var tabs = [];
	  for (var i=0; i<htmls.length; i++) {
		tabs.push(new GInfoWindowTab(labels[i],htmls[i]));
	  }
	  marker.openInfoWindowTabsHtml(tabs);
	});
	gmarkers[index] = marker;
	return marker;
}
function unloadMap(cond) {
	if (cond == true) {
		GUnload();	
	}
}
function myclick(i) {
    GEvent.trigger(gmarkers[i], "click");
}