var loaded  = false;
var objLogo = null;
var WindowWidth = 0, WindowHeight = 0;

function checkframes () {
 if (window.top.frames.length == 0) {
  var doc = document.location.href;
  window.top.location.replace (doc.substr (0, doc.lastIndexOf ("/") + 1) + "index.htm");
 }
}

function ReferenceImages(ArrayImage)
{
 if (document.preloadArray == null)
  document.preloadArray = new Array;

 document.preloadArray = ArrayImage;
 loaded = true;
}

function PreloadImages()
{
 if (document.preloadArray == null)
  document.preloadArray = new Array;

 var imgFiles = PreloadImages.arguments;
 for (var i=0; i < imgFiles.length; i++) {
  document.preloadArray[i] = new Image;
  document.preloadArray[i].src = '/images/preload/' + imgFiles[i];
 }
 loaded = true;
}

function SwapImage()
{
 if (!loaded || document.preloadArray == null)
  return;

 var i, j = 0, objStr, obj, swapArray = new Array(), oldArray = document.SwapImgData, listImages = SwapImage.arguments;
 for (i=0; i < (listImages.length - 1); i+=2) {
  objStr = listImages[i].indexOf('.') == -1 ? 'document.' + listImages[i] : listImages[i];
  obj = eval (objStr);
  if (obj != null) {
   swapArray[j++] = obj;
   swapArray[j++] = (oldArray == null || oldArray[j-1] != obj) ? obj.src : oldArray[j];
   obj.src = document.preloadArray[listImages[i+1]].src;
  } 
 }
 document.SwapImgData = swapArray; //used for restore
}

function RestoreImage()
{
 if (document.SwapImgData != null)
  for (var i=0; i < (document.SwapImgData.length - 1); i += 2)
   document.SwapImgData[i].src = document.SwapImgData[i+1];
}

function RefreshWindowSize ()
{
  if (typeof (window.innerWidth) == 'number') { //Non-IE
    WindowWidth  = window.innerWidth;
    WindowHeight = window.innerHeight;
  }
  else if (
    document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)
  ) {    //IE 6+ in 'standards compliant mode'
    WindowWidth  = document.documentElement.clientWidth;
    WindowHeight = document.documentElement.clientHeight;
  }
  else if (document.body && (document.body.clientWidth || document.body.clientHeight)) { //IE 4 compatible
    WindowWidth  = document.body.clientWidth;
    WindowHeight = document.body.clientHeight;
  }
}

function ResizeGauche()
{
  if (objLogo == null) {
    var allDiv = new Array();
    allDiv = document.getElementsByTagName ("DIV");
    for (i = 0; i < allDiv.length; ++i)
      if (allDiv[i].className == "logo") {
        objLogo = allDiv[i];
        break;
      }
  }
  RefreshWindowSize ();
  if (WindowHeight < 511) {
    objLogo.style.bottom = '';
    objLogo.style.top    = '424px';
  }
  else {
    objLogo.style.top    = '';
    objLogo.style.bottom = '20px';
  }
}

