//var eyecatcher = document.getElementById('eyecatcher');
var bgimg = document.getElementById('bgimg');
var bgdiv = document.getElementById('bgdiv');
var maincontainer = document.getElementById('maincontainer');
function resizebg(){ 
  var screenx = 0;
  var screeny = 0
  if (self.innerHeight)  {
      screenx = self.innerWidth;
      screeny = self.innerHeight;
  }
  // Explorer 6 Strict Mode
  else if (document.documentElement && document.documentElement.clientHeight) {
      screenx = document.documentElement.clientWidth;
      screeny = document.documentElement.clientHeight;
  }
  // other Explorers
  else if (document.body) {
      screenx = document.body.clientWidth;
      screeny = document.body.clientHeight;
  }    
  var ratiow = screenx / bgimg.width;
  var ratioh = screeny / bgimg.height;  
  var ratio;
  //alert(screeny);
  (ratiow < ratioh) ? ratio = ratioh : ratio = ratiow; 
   //alert (" H"+screeny+" B"+screenx+" rh"+ratioh+" rb"+ratiow+" => "+ratio);
 
  bgimg.height *=  ratio;
  //bgimg.height = screeny;
   bgdiv.style.height = screeny +"px";
  
  //alert(screeny);
  maincontainer.style.height = screeny - 152 +"px";
  //eyecatcher.style.bottom = bgimg.height - screeny +"px";
}

bgimg.onload = resizebg;
window.onresize = resizebg;
window.onload = resizebg;


