var container = { 
   id   :"container", 
   top  :50, 
   left :50 
}; 
 
function deadCentre(){ 
   if (document.getElementById(container.id)) { 
      var elm = document.getElementById(container.id); 
      // fetching width and height of container 
      cHeight = elm.offsetHeight; 
      // fetching width and height of vieuwport 
      if (self.innerHeight){ 
         // all except Explorer 
         wHeight = self.innerHeight; 
      } else if (document.documentElement && document.documentElement.clientHeight) { 
         // Explorer 6 Strict Mode 
         wHeight = document.documentElement.clientHeight; 
      } else if (document.body) { 
         // other Explorers 
         wHeight = document.body.clientHeight; 
      } 
      // calculating new container margins 
      cmTop  = wHeight - cHeight >= 0 ? Math.round((wHeight-cHeight) * (container.top/100)) + "px" : 0; 
      // parse new values to container inline-style 
      elm.style.margin = cmTop + " auto 0 auto"; 
   } 
} 

window.onload = function(){ 
   //deadCentre(); 
} 

window.onresize = function(){ 
   //deadCentre(); 
}
