here are some valuable javascript functions for getting window width and height a long with the get element X position, and Y position all of this functions are not my invention; its copied from the website and blog listed in the reference list.
lets start with getWindowDimension:

Recent comments
1 day 5 hours ago
1 week 1 day ago
2 weeks 1 day ago
2 weeks 1 day ago
6 weeks 3 days ago
7 weeks 4 days ago
27 weeks 2 days ago
27 weeks 2 days ago
31 weeks 1 day ago
42 weeks 1 day ago