// JavaScript Document
function toggleLayer( whichLayer )
{
	var elem, vis;
	switch(whichLayer)
{
case 'nulla':


 break;

default:


  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
  break;

}
}
	



function noVisible( whichLayer )
{
	var elem, vis;
	switch(whichLayer)
{
case 'nulla':
  

 break;
default:


  if( document.getElementById ) // this is the way the standards work
    elem = document.getElementById( whichLayer );
  else if( document.all ) // this is the way old msie versions work
      elem = document.all[whichLayer];
  else if( document.layers ) // this is the way nn4 works
    elem = document.layers[whichLayer];
  vis = elem.style;
  // if the style.display value is blank we try to figure it out here
  if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
    vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
  vis.display = (vis.display==''||vis.display=='block')?'none':'block';
  break;

}
}




function getHeight(){
	var altezza = 0
	var altezzaSx = document.getElementById('menuS').offsetHeight;
	var altezzaCentro=document.getElementById('mainContent').offsetHeight;
	
	
if (altezzaSx < 470) {
	altezzaSx = 470;
	}
	
	
			if(altezzaSx<=altezzaCentro){
			
			altezza=altezzaCentro;
			}
			else
			{
			altezza=altezzaSx;
			}
			
	

// SX E CENTRO
	
		document.getElementById('menuS').style.height=altezza - 13  + 'px';
		document.getElementById('mainContent').style.height=altezza  + 'px';
		
		
}



   function load() {
      if (GBrowserIsCompatible()) {
			var center = new GLatLng(43.710246, 10.41225);
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(center, 13);
				map.addControl(new GMapTypeControl());       
				map.addControl(new GLargeMapControl());
				map.addControl(new GScaleControl()); // Zomming
				
 function createMarkerA(point, description) {  

                 //  Crea il marker nel punto che viene passato  
                 var marker = new GMarker(point);  
   
                 //  Aggiunge al marker una finestra HTML in cui viene messa la  
                 //  descrizione  
                GEvent.addListener(marker, "click", function() {  
                marker.openInfoWindowHtml(description);  
             });  
 
             return marker;  
          } 
					
			map.addOverlay(createMarkerA(new GLatLng(43.70996667481622, 10.412367582321167),"PALAZZO DEI CONGRESSI"));  
			map.addOverlay(createMarkerA(new GLatLng(43.684601, 10.396221), "AEREOPORTO"));
				map.addOverlay(createMarkerA(new GLatLng(43.70916011751574, 10.398677587509155), "STAZIONE FS"));
					map.addOverlay(createMarkerA(new GLatLng(43.71057934089654, 10.395416021347046), "STAZIONE BUS"));
					
	var directionsPanel;
				var directions;
				
				directionsPanel = document.getElementById("route");
      directions = new GDirections(map, directionsPanel);
			//var fromTo = location.search;//.querystring("from") 
//			
//
//		startFrom =""
//
//			
//			switch(fromTo)
//{
//case "?loc=aereo":
// startFrom = "from:Aeroporto Galileo Galilei, Pisa to: Via Matteotti, 1, Pisa"
//	
// case "?loc=treno":
// startFrom = "from:Piazza stazione, Pisa  to: Via Matteotti, 1, Pisa"
//	
//	case "?loc=home":
//	startFrom =""
//	
//	case "?loc=auto":
//  startFrom = ""
//
//
//}
//	directions.load(startFrom);
 
			}
			
      
 
    }




 //  1. function load()  
//   2.     {  
//   3.         if (GBrowserIsCompatible()) {  
//   4.   
//   5.             // Come nel post precedente creiamo la mappa, la centriamo  
//   6.             // e aggiungiamo dei controlli  
//   7.             var map = new GMap2(document.getElementById("map"));  
//   8.             map.addControl(new GLargeMapControl());  
//   9.             map.addControl(new GMapTypeControl());  
//  10.             map.setCenter(new GLatLng(45.068150,7.688050), 10,G_HYBRID_MAP);  
//  11.   
//  12.             // Funzione che crea il Marker a cui vengono passati il punto e la  
//  13.             // descrizione  
//  14.             function createMarker(point, description) {  
//  15.   
//  16.                 //  Crea il marker nel punto che viene passato  
//  17.                 var marker = new GMarker(point);  
//  18.   
//  19.                 //  Aggiunge al marker una finestra HTML in cui viene messa la  
//  20.                 //  descrizione  
//  21.                 GEvent.addListener(marker, "click", function() {  
//  22.                 marker.openInfoWindowHtml(description);  
//  23.             });  
//  24.   
//  25.             return marker;  
//  26.           }  
//  27.   
//  28.       //    Aggiunge il Marker "Prova Via di prova 10100 Torino, Italia"  
//  29.       //    alle coordinate latitudine 45.068150 e longitudine 7.688050  
//  30.       map.addOverlay(createMarker(new GLatLng(45.068150,7.688050), "<b>Prova</b><br><br>Via di prova 10100 Torino, Italia"));  
//  31.   
//  32.         }  
//  33.     }  

