// JavaScript Document
<!--
if (screen.width <= 800)
{
 var resImage = "800x600";
 var startWidth = 800;
 var startHeight = 600;
}
else if ((screen.width > 800) && (screen.width <= 1024))
{
 var resImage = "1024x768";
 var startWidth = 1024;
 var startHeight = 768;
}
else if((screen.width > 1024) && (screen.width <= 1280))
{
 var resImage = "1280x960";
 var startWidth = 1280;
 var startHeight = 960;		
}
else if (screen.width > 1280)
{
 var resImage = "1600x1200";
 var startWidth = 1600;
 var startHeight = 1200;
}
else
{

}
//-->
 var winWidth=0;
 var winHeight=0;
 var imgWidth=startWidth;
 var imgHeight=startHeight;
 var newWidth=0;
 var newHeight=0;

 function imgResize() {
  var bgImage=document.getElementById('bgImage');
  if(window.innerWidth) {
   winWidth =window.innerWidth;
   winHeight=window.innerHeight;
  } else {
   winWidth=document.body.offsetWidth;
   winHeight=document.body.offsetHeight;
  }
  if(winHeight>imgHeight) {
   newHeight=winHeight;
   newWidth=winHeight*(imgWidth/imgHeight);
  }
  if(winHeight<imgHeight)
  {
  	newHeight=winHeight;
	newWidth=winHeight*(imgWidth/imgHeight);
  }
  if(newWidth<winWidth) {
   newWidth=winWidth;
   newHeight=newWidth*(imgHeight/imgWidth);
  }
  bgImage.style.width =newWidth;
  bgImage.style.height=newHeight;
 }
 