function pre_load_imgs()
{ (new Image()).src = "images/arrivages_over.gif";
  (new Image()).src = "images/aquarium_over.gif";
  (new Image()).src = "images/philosophie_over.gif";
  (new Image()).src = "images/actualite_over.gif";
  (new Image()).src = "images/bibliographie_over.gif";
  (new Image()).src = "images/liens_over.gif";
  (new Image()).src = "images/contact_over.gif";
  (new Image()).src = "images/tips_link_over.gif";
}


function roll_over_arrivages()
{ if(document.getElementById)
  { if(document.getElementById("a_arrivages"))
    { document.getElementById("a_arrivages").onmouseover = function() { document.getElementById("img_arrivages").src = "images/arrivages_over.gif"; }
      document.getElementById("a_arrivages").onmouseout  = function() { document.getElementById("img_arrivages").src = "images/arrivages.gif"; }
    }
  }
}

function roll_over_aquarium()
{ if(document.getElementById)
  { if(document.getElementById("a_aquarium"))
    { document.getElementById("a_aquarium").onmouseover = function() { document.getElementById("img_aquarium").src = "images/aquarium_over.gif"; }
      document.getElementById("a_aquarium").onmouseout  = function() { document.getElementById("img_aquarium").src = "images/aquarium.gif"; }
    }
  }
}

function roll_over_philosophie()
{ if(document.getElementById)
  { if(document.getElementById("a_philosophie"))
    { document.getElementById("a_philosophie").onmouseover = function() { document.getElementById("img_philosophie").src = "images/philosophie_over.gif"; }
      document.getElementById("a_philosophie").onmouseout  = function() { document.getElementById("img_philosophie").src = "images/philosophie.gif"; }
    }
  }
}

function roll_over_actualite()
{ if(document.getElementById)
  { if(document.getElementById("a_actualite"))
    { document.getElementById("a_actualite").onmouseover = function() { document.getElementById("img_actualite").src = "images/actualite_over.gif"; }
      document.getElementById("a_actualite").onmouseout  = function() { document.getElementById("img_actualite").src = "images/actualite.gif"; }
    }
  }
}

function roll_over_bibliographie()
{ if(document.getElementById)
  { if(document.getElementById("a_bibliographie"))
    { document.getElementById("a_bibliographie").onmouseover = function() { document.getElementById("img_bibliographie").src = "images/bibliographie_over.gif"; }
      document.getElementById("a_bibliographie").onmouseout  = function() { document.getElementById("img_bibliographie").src = "images/bibliographie.gif"; }
    }
  }
}

function roll_over_liens()
{ if(document.getElementById)
  { if(document.getElementById("a_liens"))
    { document.getElementById("a_liens").onmouseover = function() { document.getElementById("img_liens").src = "images/liens_over.gif"; }
      document.getElementById("a_liens").onmouseout  = function() { document.getElementById("img_liens").src = "images/liens.gif"; }
    }
  }
}

function roll_over_plan()
{ if(document.getElementById)
  { if(document.getElementById("a_plan"))
    { document.getElementById("a_plan").onmouseover = function() { document.getElementById("img_plan").src = "images/plan_over.gif"; }
      document.getElementById("a_plan").onmouseout  = function() { document.getElementById("img_plan").src = "images/plan.gif"; }
    }
  }
}

function roll_over_contact()
{ if(document.getElementById)
  { if(document.getElementById("a_contact"))
    { document.getElementById("a_contact").onmouseover = function() { document.getElementById("img_contact").src = "images/contact_over.gif"; }
      document.getElementById("a_contact").onmouseout  = function() { document.getElementById("img_contact").src = "images/contact.gif"; }
    }
  }
}

function roll_over_tips_link()
{ if(document.getElementById)
  { if(document.getElementById("a_tips_link"))
    { document.getElementById("a_tips_link").onmouseover = function()
	  { document.getElementById("tips_link").style.backgroundImage = "url(images/tips_link_over.gif)";
	  }
      document.getElementById("a_tips_link").onmouseout  = function()
	  { document.getElementById("tips_link").style.backgroundImage = "url(images/tips_link.gif)";
	  }
    }
  }
}

var flash_info_content = "Flash information : phrase défilante désactivable"
var v_flash_info = new Array();
var current_info = 0;

function init_info()
{ xml_info = loadXMLDoc("php/load_infos.php");
  nodeList = xml_info.getElementsByTagName("info");
  for(i = 0; i < nodeList.length; i++) v_flash_info.push(nodeList[i].childNodes[0].nodeValue);
}

function loadXMLDoc(url)
{ var req = false;
  if(window.XMLHttpRequest && !(window.ActiveXObject))
  { try { req = new XMLHttpRequest(); }
	catch(e) { req = false; }
  }
  else if(window.ActiveXObject)
  { try { req = new ActiveXObject("Msxml2.XMLHTTP"); }
    catch(e)
    { try { req = new ActiveXObject("Microsoft.XMLHTTP");	}
      catch(e) { req = false; }
    }
  }
  if(req)
  { req.open("GET", url, false);
    req.send("");
    return req.responseXML;
  }
  return null;
}

function scroll_info(n)
{ if(typeof(n) == "undefined") n = 0;
  var blanc="                                                                                 ";
  var texte = typeof(v_flash_info[current_info]) == "undefined" ? "" : v_flash_info[current_info];
  var scrolling_text = blanc + texte;
  scrolling_text = scrolling_text.substring(n,scrolling_text.length);
  document.flash_info_message.scroll_text.value = scrolling_text;
  if(scrolling_text.length > 0) n ++;
  else
  { n = 0;
    current_info++;
	if(current_info >= v_flash_info.length) current_info = 0;
  }
  s = n;
  n = setTimeout("scroll_info(s)", 120);
}

function addLoadEvent(func)
{ var oldonload = window.onload;
  if(typeof window.onload != 'function') window.onload = func;
  else
  { window.onload = function()
    { if(oldonload) oldonload();
      func();
    }
  }
}

function pop_img(src, width, height)
{ window.open(src,"","scrollbars=yes,width=" + width + ",height=" + height);
}

addLoadEvent(roll_over_arrivages);
addLoadEvent(roll_over_aquarium);
addLoadEvent(roll_over_philosophie);
addLoadEvent(roll_over_actualite);
addLoadEvent(roll_over_bibliographie);
addLoadEvent(roll_over_liens);
addLoadEvent(roll_over_plan);
addLoadEvent(roll_over_contact);
addLoadEvent(roll_over_tips_link);
addLoadEvent(pre_load_imgs);
addLoadEvent(init_info);
addLoadEvent(scroll_info);
