//<![CDATA[
// window.onload = onPageLoad;
var map;


		
function load() {
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById("map"));
		map.setCenter(new GLatLng(22.07695, 96.587305), 5);
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
		map.addMapType(G_PHYSICAL_MAP);
		map.setMapType(G_PHYSICAL_MAP);
		map.enableContinuousZoom();
		map.hideControls();
		// mgr = new MarkerManager(map);
		
		
		


var hierarchy = new GHierarchicalMapTypeControl();
hierarchy.addRelationship(G_HYBRID_MAP, null, true);
map.addControl(hierarchy,new GControlPosition(G_ANCHOR_TOP_LEFT,new
GSize(0,-2000)));
// Run a set timeout to wait a few seconds until google actually
// creates the object to grab hold of it
setTimeout("positionMapType()",1000);
// function to grab your map type and move it where you'd like
positionMapType=function(){
    // Here you can just set the styles on the map and put it
    // where ever you want.  I have mine permanently set
    // 292pixels to the left of the vertical center of the map.
    var mtmove=document.getElementById("hmtctl");
        mtmove.style.zIndex=-30;
        mtmove.style.width="200px";
		mtmove.style.height="50px";
        mtmove.style.top="86px";
        mtmove.style.left="50%";
        mtmove.style.marginTop="0px";
        mtmove.style.marginLeft="-2000";
		mtmove.style.background="#000";

        // You can also grab the children by div id
        // and customize the colors/fonts/etc...
        var a0=document.getElementById("amtc_option_0");
        a0.style.border="0";
        a0.style.background="#000";
        var a1=document.getElementById("amtc_option_1");
        a1.style.border="0";
        a1.style.background="#000";
        var a2=document.getElementById("amtc_option_2");
        a2.style.border="0";
        a2.style.background="#000";
        var a3=document.getElementById("amtc_option_3");
        a3.style.border="0";
        a3.style.background="#000";

}


		
		
	}
}


function LoadMarkers(FileXML) {
	map.clearOverlays();
	// mgr.clearMarkers();
	GDownloadUrl (FileXML, function(data) {
		var xml = GXml.parse(data);
		var markers = xml.documentElement.getElementsByTagName("marker");
		var marker = new Array;
		
		for (var i = 0; i< markers.length; i++) {
			// document.write("marker"+i);
			// var name = markers[i].getAttribute("name");
			// var address = markers[i].getAttribute("address");
			// var type = markers[i].getAttribute("type");
			var point = new GLatLng(parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng")));
			var label = markers[i].getAttribute("label");
			var imgico = markers[i].getAttribute("imgico");
			var idmarker = markers[i].getAttribute("idmarker");
			var importanza = markers[i].getAttribute("importanza");
			var SrcImg = "img/";
			var imgicooff = SrcImg+imgico+".png";
			var imgicoon = SrcImg+imgico+"_over.png";
			
			var Myicon = new GIcon();
			Myicon.image = imgicooff;
			
			if (importanza != 0) {
				Myicon.iconSize = new GSize(33, 32);
				Myicon.iconAnchor = new GPoint(16, 16);
			} else {
				Myicon.iconSize = new GSize(21, 21);
				Myicon.iconAnchor = new GPoint(10, 10);
			}
			
			Myicon.infoWindowAnchor = new GPoint(5, 1);
			
			marker[i] = new PdMarker(point, Myicon);
			marker[i].my_id = idmarker;
			marker[i].setTooltip(label);
			marker[i].setHoverImage(imgicoon);			
			// marker[i].onClick = ajaxpage('show_city.php?IDN='+idmarker, 'contenutitour');
			
			/* 
			GEvent.addListener(marker[i], "click", function() {
			ajaxpage(pagina, 'contenutitour');
			}); */
				
			if (importanza != 0) {
				map.addOverlay(marker[i]);
			} else {
				map.addOverlay(marker[i]);
				//mgr.addMarker(marker[i], 6);
				//mgr.getMarkerCount(5);
				// mgr.refresh();
			}
			
			
			//mgr = new GMarkerManager(map);
			//mgr.addMarker(marker, 8 );


			//mgr.getMarkerCount(5);
			//mgr.refresh();
			
			
			
			//map.addOverlay(marker);
		}
	});
}
	

	
	//]]>


function vedimappa() {
if(document.getElementById('colonnasx').style.display =='none'){
document.getElementById('colonnasx').style.display='';
document.getElementById('colonnadx').style.width='';
document.getElementById('tastochiudi').style.display='';
document.getElementById('tastoapri').style.display='none';
document.getElementById('container').style.background='';
	}
else{
document.getElementById('colonnasx').style.display='none';
document.getElementById('colonnadx').style.width='730px';
document.getElementById('tastochiudi').style.display='none';
document.getElementById('tastoapri').style.display='';
document.getElementById('container').style.background='none';
	}
} 

function LoadTour(IDTour) {	
	LoadMarkers('gen_xml.php?IDT='+IDTour);
	ajaxpage('show_tour.php?IDT='+IDTour, 'contenutitour');
}

function LoadPlace(IDPlace) {	
	LoadMarkers('gen_xml.php?IDN='+IDPlace);
	ajaxpage('show_city.php?IDN='+IDPlace, 'contenutitour');
}
