Subversion Repositories SmartDukaan

Rev

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

Rev 24046 Rev 24052
Line 21... Line 21...
21
	
21
	
22
	$('#retailerAddressState').live('change', function() { 
22
	$('#retailerAddressState').live('change', function() { 
23
	    var stateName = $(this).find('option:selected').text();
23
	    var stateName = $(this).find('option:selected').text();
24
	    loadDistrictNames(stateName);
24
	    loadDistrictNames(stateName);
25
	});
25
	});
26
	
-
 
27
	var actualLatitude = $('.fofo-store-latitude').val();
-
 
28
	var actualLongitude = $('.fofo-store-longitude').val();
-
 
29
	if(actualLatitude != null && actualLongitude != null){
-
 
30
		navigator.geolocation.getCurrentPosition(function(position){
-
 
31
			console.log("actualLatitude : "+actualLatitude);
-
 
32
			console.log("actualLongitude : "+actualLongitude);
-
 
33
			console.log("latitude : "+position.coords.latitude);
-
 
34
			console.log("longitude : "+position.coords.longitude);
-
 
35
			var distance = getDistance(actualLatitude, actualLongitude, position.coords.latitude, position.coords.longitude);
-
 
36
			$('.fofo-store-distance-in-meter>span').text(distance * 1000);
-
 
37
			$('.fofo-store-distance').val(distance * 1000);
-
 
38
		});
-
 
39
	}
-
 
40
});
26
});
41
 
27
 
42
function getDistance(lat1, lon1, lat2, lon2) {
28
function getDistance(lat1, lon1, lat2, lon2) {
43
	  var deg2rad = 0.017453292519943295; // === Math.PI / 180
29
	  var deg2rad = 0.017453292519943295; // === Math.PI / 180
44
	  var cos = Math.cos;
30
	  var cos = Math.cos;