
  var geocoder;
  function initialize() {
    
  }

  function codeAddress() {
	  if ($('suche_ort').value != "Ort" && $('suche_ort').value != ""){
		  $('searchbutton').value = "suche...";
		  geocoder = new google.maps.Geocoder();
	    var address = document.getElementById("suche_ort").value;
	    if (geocoder) {
	      geocoder.geocode( { 'address': address}, function(results, status) {
	        if (status == google.maps.GeocoderStatus.OK) {
	        	$('lat').value = results[0].geometry.location.lat();
	        	$('lng').value = results[0].geometry.location.lng();
	          $('start_suche').submit();
	        } else {
	          alert("Geocode was not successful for the following reason: " + status);
	        }
	      });
	    }
	  }else{
		 $('start_suche').submit();  
	  }
  }
 
  
  function codeAddress3() {
	  $('searchbutton3').value = "suche Geokoordinaten...";
	  geocoder = new google.maps.Geocoder();
    var address = $("strasse").value + ", " + $("plz").value + " " + $("ort").value ;
    if (geocoder) {
      geocoder.geocode( { 'address': address}, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
        	$('lat3').value = results[0].geometry.location.lat();
        	$('lng3').value = results[0].geometry.location.lng();
          $('reg_form').submit();
        } else {
          alert("Geocode was not successful for the following reason: " + status);
        }
      });
    }
  }
