
	function isValidChar(strString,strValidChars){
	   //var strValidChars = "0123456789.-";
	   var strChar;
	   var blnResult = true;

	   if (strString.length == 0) return false;

	   //  test strString consists of valid characters listed above
	   for (i = 0; i < strString.length && blnResult == true; i++)
	      {
	      strChar = strString.charAt(i);
	      if (strValidChars.indexOf(strChar) == -1)
	         {
	         blnResult = false;
	         }
	      }
	   return blnResult;
	}
	
	/*
	*	Funzione che mi controlla la mail
	*	mi restituisce true se il valore non è nullo altrimenti false
	*/
	function isValidMail(mail){
		var espressione = /^(.+)@(.+)\.(.+)$/;
		if (!espressione.test(mail)){
			    return false;
		} else {
			return true;
		}
	}
	
	/**
	*	Funzione per trovare il numero di parole o caratteri in una stringa
	*/
	function countwords(string, what){
		var ret = false;
		if($.trim(string) == ""){
			return ret;
		}
		switch(what){
			case "words":
				string = string.split(" ");
				ret = string.length;
			break;
			
			case "caracters":
				ret = string.length;
			break;
			
			default:
			break;
		}
		return ret;
	}
    
    
    
    var map = null;
    var geocoder = null;

    function load() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map"));
        map.addControl(new GSmallMapControl());
        map.addControl(new GMapTypeControl());
        //map.setCenter(new GLatLng(41.91633, 12.482185), 5);
        geocoder = new GClientGeocoder();
      }
    }

    function smallLoad(dmap) {
      if (GBrowserIsCompatible()) {
        map = new GMap2(dmap);
        map.addControl(new GSmallMapControl());
        //map.addControl(new GMapTypeControl());
        //map.setCenter(new GLatLng(41.91633, 12.482185), 5);
        geocoder = new GClientGeocoder();
      }
    }


    function showAddress(address, citta) {
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
                
                  if (geocoder) {
                    geocoder.getLatLng(
                      citta,
                      function(point) {
                        if (!point) {
                          //alert(address + " not found");
                        } else {
                          map.setCenter(point, 16);
                          var marker = new GMarker(point);
                          map.addOverlay(marker);
                          //marker.openInfoWindowHtml(address);
                        }
                      }
                    );
                  }
                  
            } else {
              map.setCenter(point, 16);
              var marker = new GMarker(point);
              map.addOverlay(marker);
              //marker.openInfoWindowHtml(address);
            }
          }
        );
      }
    }

    function smallShowAddress(address,citta) {
    //  alert(citta);
          if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              
                  if (geocoder) {
                    geocoder.getLatLng(
                      citta,
                      function(point) {
                        if (!point) {
                          //alert(address + " not found");
                        } else {
                              map.setCenter(point, 14);
                              var marker = new GMarker(point);
                              map.addOverlay(marker);
                        }
                      }
                    );
                }
        
            } else {
                  map.setCenter(point, 14);
                  var marker = new GMarker(point);
                  map.addOverlay(marker);
            }
          }
        );
      }
    }


    function google(id, indirizzo, citta)
    {
        
        datizoom = document.getElementById("dati_zoom");
        
        datiid = document.getElementById("dati_" + id);
        datizoom.innerHTML = datiid.innerHTML;
        
        dmap = document.getElementById("popmap");
        lleft = 50;
        modalx = document.getElementById("modal");
        dmap.style.display = 'block';
        
        load(dmap);
        showAddress(indirizzo + ' Italy',citta);
    }

    function smallgoogle(indirizzo,target,citta)
    {
        dmap = document.getElementById(target);
        dmap.style.display = 'block';
        smallLoad(dmap);
        smallShowAddress(indirizzo + ' Italy',citta);
    }

    function smallChiudiGoogle(target){
        dmap = document.getElementById(target);
        dmap.style.display = 'none';
        GUnload();
    }

    function chiudiGoogle(){
        dmap = document.getElementById("popmap");
        dmap.style.display = 'none';
        fmodal = document.getElementById("modal");
        fmodal.style.display = 'none';

        GUnload();
    }

    // Specifica se il contenuto deve essere solo selezionato oppure anche copiato negli appunti
    // 0=no, 1=si
    var copytoclip=1;
