Revert "Revert "sistemato magine popup""

This reverts commit 3a8f0a89dc728039402fa4bcb33e43f4c95c3e3c.
Calcolo distanza....da sistemare!!!