change the place of the marker with the click
===

i am working on google maps, what i want to do is to click on the map it add a marker to the map its working fine but the problem is that i need to move the same marker to a new place if i click some where else instead of new marker (one existing and one new). and also when i click on any point it give me the address of that place in a text field

here is my code

       <script type="text/javascript">
	var map;
	var markersArray = [];

     function initialize() {
        var haightAshbury = new google.maps.LatLng(37.7699298, -122.4469157);
  	var mapOptions = {
        zoom: 7,
        center: haightAshbury,
        mapTypeId: google.maps.MapTypeId.ROADMAP
       };
       map =  new google.maps.Map(document.getElementById("map_canvas"), mapOptions);

        google.maps.event.addListenerOnce(map, 'click', function(event) {
        addMarker(event.latLng);
       });
       }

       function addMarker(location) {
	
       marker = new google.maps.Marker({
       position: location,
       map: map
       });
       markersArray.push(marker);
       }

       // Removes the overlays from the map, but keeps them in the array
       function clearOverlays() {
	alert('i m here');
        if (markersArray) {
         for (i in markersArray) {
           markersArray[i].setMap(null);
          }
        }
      }

       // Shows any overlays currently in the array
         function showOverlays() {
          if (markersArray) {
            for (i in markersArray) {
              markersArray[i].setMap(map);
            }
          }
        }

      // Deletes all markers in the array by removing references to them
      function deleteOverlays() {
        if (markersArray) {
          for (i in markersArray) {
            markersArray[i].setMap(null);
          }
          markersArray.length = 0;
          }
         }