Fixed popup offset calculations, and made some adjustments for firefox particularities.