// JavaScript Document
/*$(document).ready(function() {
     $("#bkgdimg").load(function(){
          resizeImage();
     })
	
     $(window).resize(function(){
          resizeImage();
     })

     function resizeImage(){
          $("#bkgdimg").css("left","0");
          var doc_width = $(window).width();
          var doc_height = $(window).height();
          var image_width = $("#bkgdimg").width();
          var image_height = $("#bkgdimg").height();
          var image_ratio = image_width/image_height;      
          var new_width = doc_width;
          var new_height = Math.round(new_width/image_ratio);
          if(new_height<doc_height){
               new_height = doc_height;
               new_width = Math.round(new_height*image_ratio);
               var width_offset = Math.round((new_width-doc_width)/2);
               $("#bkgdimg").css("left","-"+width_offset+"px");
          }
          $("#bkgdimg").width(new_width);
          $("#bkgdimg").height(new_height);
     }
});*/

function resizeImage()
{
 var window_height = window.innerHeight
 var window_width = window.innerWidth
 var image_width = document.images[0].width
 var image_height = document.images[0].height
 var height_ratio = image_height / window_height
 var width_ratio = image_width / window_width
 if (window_width / window_height > 1280 / 859)
 {
 document.images[0].style.width = window_width + "px";
 document.images[0].style.height = window_width / 1280 * 859 + "px";
 document.images[0].style.left = 0;
 document.images[0].style.top = (window_height - (window_width / 1280 * 859))/ 3 + "px";/**/
 }
 else
 {
 document.images[0].style.height = window_height + "px";
 document.images[0].style.width = window_height / 859 * 1280 + "px";
 document.images[0].style.top = 0;
 document.images[0].style.left = (window_width - window_height / 859 * 1280) / 3 + "px";/**/
 }
}
 
