var geocoder;
  var map;
  var marker;


  function initialize() {
    geocoder = new google.maps.Geocoder();
    var latlng = new google.maps.LatLng( 19.435352459490915, -99.13307189941406);
    var myOptions = {
      zoom: 14,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
  }
 
  function codeAddress() {
    var address = document.getElementById("address").value;
    geocoder.geocode( { 'address': address}, function(results, status) {
      if (status == google.maps.GeocoderStatus.OK) {
        map.setCenter(results[0].geometry.location);
        
        marker = new google.maps.Marker({
            map: map, 
            animation: google.maps.Animation.DROP,
            title: results[0].formatted_address ,
            position: results[0].geometry.location
        });
        google.maps.event.addListener(marker, 'click', toggleBounce);
      } else {
        alert("No ha sido posible ubicar el sitio por lo siguiente: " + status);
      }
    });
  }



  function toggleBounce() {

	  if (marker.getAnimation() != null) {
	    marker.setAnimation(null);
	  } else {
	    marker.setAnimation(google.maps.Animation.BOUNCE);
	  }
  }

