﻿


/****************************
Mise en place de L'interface
****************************/
function chooseThePict() {

            var myPict = $$('.bgSite');
            var theWinnerIs = myPict.getRandom();
            
            $('photoContainer').innerHTML = "<img src='" +theWinnerIs.href +"' id='bgSite' class='bgSite2' alt='' />";
            }
            
            
  function getInterface() {
  
            
            
  
        if (document.all) {
            winW = document.documentElement.clientWidth;
            winH = document.documentElement.clientHeight;
        } else {
            winW = window.innerWidth;
            winH = window.innerHeight;
        }
        
        var bgSite = $('bgSite')
        var Wrap = $('Wrap')
        
        Wrap.setStyle({width: winW + "px"});
        Wrap.setStyle({height: winH+ "px"});

           var pictW = winH * 0.6;

           bgSite.setStyle({height: winH+ "px"});
           bgSite.setStyle({width: pictW+ "px"});

         var thPict = $('bgSite');  
        Event.observe(thPict, "load", lookAtPict);
        
    }
 
 function lookAtPict() {
 
     var bgSite = $('bgSite')
     var Wrap = $('Wrap')
        
 var imgWidth = bgSite.getWidth();
        var imgHeight = bgSite.getHeight();
        
        if (imgHeight < winH) {
           bgSite.setStyle({width:"auto"});
           bgSite.setStyle({height: winH + "px"});
        }
 
 
 } 
 
Event.onDOMReady(function() {chooseThePict();});  
Event.onDOMReady(function() {getInterface();});
Event.observe(window, "resize", getInterface);


// Fonction pour les effets de survol sur les images
function rollOver(myPict) {
    var str = myPict.src;
    var myPictURL = str.slice(0,-6);
    
    if (str.lastIndexOf('_of.gif') != -1){
        myPict.src= myPictURL + "ov.gif"
    }
    else {
        myPict.src= myPictURL + "of.gif"
    }
 
}

