var latitude,longitude,location_by;

function getLatLng(visitID,action,desktop)
{		
			////	this javascript uses the navigator to detect location		
			useragent = navigator.userAgent;
			function displayLocation(position)
			{
		
				latitude = position.coords.latitude;
				longitude = position.coords.longitude;
				location_by = 'device';
		
				if(latitude!='' && longitude!='')
				{			
					var jquery_latlang = jQuery.noConflict();
					jquery_latlang.get(action,{latitude:position.coords.latitude,longitude:position.coords.longitude,visitID:visitID,location_by:location_by}, function(data) {
     				handleLatLngResponse(data);
					});

					return false;
				}
			}

			function handleError(error)
			{
				switch (error.code){
					case error.TIMEOUT:
								break;
					case error.POSITION_UNAVAILABLE:
								break;
					default:
							break;
				}
			}
			
			
			function handleLatLngResponse(transport)
			{
				// create jQuery.noConflict() object to resolve jquery conflict
			    var aj_res = jQuery.noConflict();
			    aj_res('#showload').html(transport);
			}
			////	we can detect if it's android or iPhone, 
			////	we will do that even though to begin with we are not "tracking" and only setting data on the landing page
	
			if (useragent.indexOf('iPhone') != -1 || useragent.indexOf('Android') != -1) {

				navigator.geolocation.getCurrentPosition(displayLocation, handleError);
			// or let other geolocation capable browsers to get their static position
			} 
			else if (navigator.geolocation) {
				navigator.geolocation.getCurrentPosition(displayLocation, handleError);
			}
									
}
