﻿/*************************************************************
/ DeadCenter
/ Copyright 2008 Aculade, LLC (www.aculade.com)
/ You are granted a non-exclusive, non-transferrable license
/    to use, distribute, perform, publically display, and
/    modify this code. You may use it however you please,
/    for any legal purpose personal and commercial.
/ You may NOT take credit for it as your own.
/ You cannot remove this header which guarantees these
/    rights to everyone else.
*************************************************************/

var v_middle = document.getElementById('v_middle')
var v_middle_height = 0;
var avail_height = 0;
var my_content_height = 582; // This is how big your content is, set it to whatever you need.
var my_content_width = 1009;  // This is the width you want your box to be.

go_deadCenter();

function go_deadCenter() {
   if (parseInt(navigator.appVersion)>3) {
      if (navigator.appName.indexOf("Microsoft") >= 0) {
         avail_height = document.body.offsetHeight;
         avail_width = document.body.offsetWidth;
         if (avail_height > my_content_height && avail_width > my_content_width)
            center_vmiddle();
      }
      else if (navigator.appName=="Netscape") {
         avail_height = window.innerHeight;
         avail_width = window.innerWidth;
         if (avail_height > my_content_height && avail_width > my_content_width)
            center_vmiddle();
      }
   }
}
function center_vmiddle() {
   v_middle.style.position = "absolute";
   v_middle.style.top = "50%";
   v_middle.style.left = "50%";
   v_middle.style.width = my_content_width;
   v_middle.style.height = my_content_height;

   half_height = (my_content_height / 2) + 10;
   v_middle.style.marginTop = "-"+half_height+"px";
   half_width = (my_content_width / 2) + 10;
   v_middle.style.marginLeft = "-"+half_width+"px";
}