Updated distance calculation script and added FBuserid script

JS functionality changes