var imgOriginSrc;
var currentTab = 1;
var prefix;

function rollInit() {
    if (!document.getElementById) return
    var imgOriginSrc;
    var imgTemp = new Array();
    var imgarr = document.getElementsByTagName('img');
    for (var i = 0; i < imgarr.length; i++) {
        if (imgarr[i].getAttribute('hsrc')) {
            imgTemp[i] = new Image();
            imgTemp[i].src = imgarr[i].getAttribute('hsrc');
            imgarr[i].onmouseover = function() {
                imgOriginSrc = this.getAttribute('src');
                this.setAttribute('src',this.getAttribute('hsrc'))
            }
            imgarr[i].onmouseout = function() {
                this.setAttribute('src',imgOriginSrc)
            }
        }
    }
}

function rollOver(id) {
    imgTemp = document.getElementById(id);
    imgOriginSrc = imgTemp.src;
    imgTemp.src = imgTemp.hsrc;
}

function rollOut(id) {
    imgTemp = document.getElementById(id);
    imgTemp.src = imgOriginSrc;
}

function tabOver(id) {
  if ( currentTab==2 & id==1 ) document.getElementById('tab1').src="img/tab0/reg_h.gif";
  if ( currentTab==1 & id==2 ) document.getElementById('tab2').src="img/tab0/dep_h.gif";
}

function tabOut(id) {
    if ( currentTab==2 & id==1 ) document.getElementById('tab1').src="img/tab0/reg_d.gif";
    if ( currentTab==1 & id==2 ) document.getElementById('tab2').src="img/tab0/dep_d.gif";
}

function changeTab(id)
{
  if (id==2)
    {
      document.getElementById('content1').style.display="none"; /* hidden"; */
      /* document.getElementById('content1').style.zindex = 1; */
      document.getElementById('content2').style.display="block";
      /* document.getElementById('content2').style.zIndex = 2; */
      
      document.getElementById('tab1').src = "img/tab0/reg_d.gif";
      document.getElementById('tab2').src = "img/tab0/dep_a.gif";
      currentTab = 2;
    }
    else
    {
      document.getElementById('content2').style.display="none";
      /* document.getElementById('content2').style.zIndex = 1; */
      document.getElementById('content1').style.display="block";
      /* document.getElementById('content1').style.zIndex = 2; */

      document.getElementById('tab1').src = "img/tab0/reg_a.gif";
      document.getElementById('tab2').src = "img/tab0/dep_d.gif";
      currentTab = 1;
    }
}

if (window.addEventListener)
    window.addEventListener("load",rollInit,false);
else if (window.attachEvent)
    window.attachEvent("onload",rollInit);

   
function viewMap(id)
{
    if (id==2) {
        document.images.carte.src="img/tab0/carte_oise.html";
        document.images.oise.src ="img/tab0/oise_h.html"; }
    else if (id==1) {
        document.images.carte.src="img/tab0/carte_somme.html";
        document.images.somme.src="img/tab0/somme_h.html"; }
    else if (id==3) {
        document.images.carte.src="img/tab0/carte_aisne.html";
        document.images.aisne.src="img/tab0/aisne_h.html"; }
    else {
        document.images.carte.src="img/tab0/carte.html";
        document.images.aisne.src="img/tab0/aisne.html";
        document.images.somme.src="img/tab0/somme.html";
        document.images.oise.src ="img/tab0/oise.html"; }
}

function split_search()
{
    if ( document.searchtypeform.searchType[0].checked == true )  
         document.searchform.action="/search_site"
    else document.searchform.action="/search_htdig"
    document.searchform.submit();
}

function goTopOfPage()
{
    document.location = document.location && '#TOP';
}

