- if (self.innerWidth)
- {
- wwidth = self.innerWidth;
- wheight = self.innerHeight;
- }
- else if (document.documentElement && document.documentElement.clientWidth)
- {
- wwidth = document.documentElement.clientWidth;
- wheight = document.documentElement.clientHeight;
- }
- else if (document.body)
- {
- wwidth = document.body.clientWidth;
- wheight = document.body.clientHeight;
- }
+
+ var wwidth = window.getWidth();
+ var wheight = window.getHeight();
+
+ ibox.style.top = window.getScrollTop() + ((wheight - bheight) / 2) + 'px';
+ ibox.style.left = ((wwidth - bwidth) / 2) + "px";