Subversion Repositories Applications.bazar

Rev

Rev 476 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 476 Rev 478
Line 120... Line 120...
120
			' ;
120
			' ;
121
		} 
121
		} 
122
	    $script .= 'geocoder = new google.maps.Geocoder();
122
	    $script .= 'geocoder = new google.maps.Geocoder();
123
	};
123
	};
124
	function showAddress() {
124
	function showAddress() {
125
		var adresse = document.getElementById("bf_adresse").value;
125
        var adresse = document.getElementById("bf_adresse").value;
-
 
126
        if (adresse == "") {
-
 
127
            return false;
-
 
128
        }
126
    	var ville = "";
129
        var ville = "";
127
	  	if (document.getElementById("bf_ville")) {
130
        if (document.getElementById("bf_ville")) {
128
	  		ville = document.getElementById("bf_ville").value ;
131
            ville = document.getElementById("bf_ville").value ;
129
	  	}
132
        }
130
	  	var cp = document.getElementById("bf_cp_lieu_evenement").value ;
133
        var cp = document.getElementById("bf_cp_lieu_evenement").value ;
131
	    var pays;
134
        var pays;
132
	  	if (document.getElementById("liste30")) {
135
        if (document.getElementById("liste30")) {
133
	  		var selectIndex = document.getElementById("liste30").selectedIndex;
136
            var selectIndex = document.getElementById("liste30").selectedIndex;
134
	  		pays = document.getElementById("liste30").options[selectIndex].text ;
137
            pays = document.getElementById("liste30").options[selectIndex].text ;
135
	  	} else {
138
        } else {
136
	  		pays = document.getElementById("bf_pays").value;
139
            pays = document.getElementById("bf_pays").value;
137
	  	}
140
        }
138
	  	var address = adresse + \' \' + \' \' + cp + \' \' + ville + \' \' +pays ;
141
        var address = adresse + \' \' + \' \' + cp + \' \' + ville + \' \' +pays ;
139
	  	if (geocoder) {
142
        if (address && geocoder) {
140
	    	geocoder.geocode({
143
            geocoder.geocode({
141
	    		address: address
144
                address: address
142
	    	}, function(result, status) {
145
            }, function(result, status) {
143
	    		 if (status != google.maps.GeocoderStatus.OK) {
146
                 if (status != google.maps.GeocoderStatus.OK) {
144
    				alert(address + " not found");
147
                    alert(address + " not found");
145
			} else {
148
            } else {
146
			marker.setMap(null);
-
 
147
			marker = null;
-
 
148
			//map.setCenter(point, 13);
-
 
149
			map.fitBounds(result[0].geometry.viewport);
149
                map.fitBounds(result[0].geometry.viewport);
150
			marker = new google.maps.Marker({
150
                marker = new google.maps.Marker({
151
				position: result[0].geometry.location,
151
                    position: result[0].geometry.location,
152
				draggable: true,
152
                    draggable: true,
153
				map: map
153
                    map: map
154
				});
154
                });
155
			google.maps.event.addListener(marker, "dragend", function () {
155
                google.maps.event.addListener(marker, "dragend", function () {
156
					coordMarker = marker.getPosition() ;
156
                    coordMarker = marker.getPosition() ;
157
					flat.value = coordMarker.lat();
157
                    flat.value = coordMarker.lat();
158
					flon.value = coordMarker.lng();
158
                    flon.value = coordMarker.lng();
159
				});
159
                });
160
			setLatLonForm(marker);
160
                setLatLonForm(marker);
161
			//marker.openInfoWindowHtml(address+ "'.BAZ_GOOGLE_MSG.'");
161
                //marker.openInfoWindowHtml(address+ "'.BAZ_GOOGLE_MSG.'");
162
		}
162
            }
163
      		});
163
        });
164
  		}
164
    }
165
	}
165
    }
166
	function setLatLonForm(marker) {
166
	function setLatLonForm(marker) {
167
  		coordMarker = marker.getPosition() ;
167
  		coordMarker = marker.getPosition() ;
168
  		flat.value = coordMarker.lat();
168
  		flat.value = coordMarker.lat();
169
  		flon.value = coordMarker.lng();
169
  		flon.value = coordMarker.lng();
170
	}
170
	}