﻿
// @require sys.js

// Etire l'image à la taille de l'écran en respectant la proportion
function imgStretchImage(img_id, prop)
{
   var dim = sysGetWindowSize();
   var win_w = dim.width;
   var win_h = dim.height;
   
   var new_img_w;
   var new_img_h;
   
   new_img_h = win_h;
   // on agrandit l'image en hauteur, mais on doit garder la proportion
   new_img_w = new_img_h / prop;
   if ( new_img_w < win_w )
   {
      // Mais si l'image devient moins large que la fenêtre, il faut l'agrandir
      var zoom_factor = win_w / new_img_w;
      new_img_h = new_img_h * zoom_factor;
      new_img_w = win_w;
   }

   if ( new_img_w != undefined && new_img_h != undefined )
   {
	   var bg_img = document.getElementById(img_id);
	   bg_img.width = new_img_w;
	   bg_img.height = new_img_h;
   }
}

function imgRollover(img, src)
{
   img.src = src;
}
