var geocoder;
  var map;
  function initialize(address) {
    geocoder = new google.maps.Geocoder();
    var latlng = new google.maps.LatLng(-34.397, 150.644);
    var myOptions = {
      zoom: 15,
      center: latlng,
    mapTypeControl: false,
    mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
      navigationControl: true,
      navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
    if (geocoder) {
      geocoder.geocode( { 'address': address}, function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
          if (status != google.maps.GeocoderStatus.ZERO_RESULTS) {
          map.setCenter(results[0].geometry.location);

           /* var infowindow = new google.maps.InfoWindow(
                { content: '<b>'+yritys+'</b>',
                  size: new google.maps.Size(150,50)
                });*/
    
            var marker = new google.maps.Marker({
                position: results[0].geometry.location,
                map: map, 
                title:address
            }); 
            
	

          } else {
            alert("No results found");
          }
        } else {
          alert("Geocode was not successful for the following reason: " + status);
        }
      });
    }
  }
  function codeLatLng(coords) {
	  
	geocoder = new google.maps.Geocoder();
    var latlng = new google.maps.LatLng(-34.397, 150.644);
    var myOptions = {
      zoom: 15,
      center: latlng,
    mapTypeControl: false,
    mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU},
      navigationControl: true,
      navigationControlOptions: {style: google.maps.NavigationControlStyle.SMALL},
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
	  
	 map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
	 
	var lat_lng = coords.split(',');
	
	
    var latlng = new google.maps.LatLng(lat_lng[0], lat_lng[1]);
    geocoder.geocode({'latLng': latlng}, function(results, status) {
      if (status == google.maps.GeocoderStatus.OK) {
        if (results[1]) {
			
		  map.setCenter(latlng);
          map.setZoom(15);
          marker = new google.maps.Marker({
              position: latlng, 
              map: map
          }); 
          //infowindow.setContent(results[1].formatted_address);
          //infowindow.open(map, marker);
        } else {
          alert("No results found");
        }
      } else {
        alert("Geocoder failed due to: " + status);
      }
    });
  }
	function test(){
	
	var div = document.getElementById('map_canvas');
	
	var a = div.getElementsByTagName('a');
	
	window.open(a[0]);
	
	}
