Screenutil.js

is a simple javascript “object” or “class” that can be used to get the center position of your screen, it was originally created to help in displaying modal windows and making sure they are always on the middle of the page.

Source can be found here on github screenutil.js