var delay1=10;
var yyy= new Array();
var ff= new Array();
var zzz= new Array();
var cible= new Array();


function getPositiony(objet)
{   obj=document.getElementById(objet);
    var topValue= 1;
    while(obj){
	topValue+= obj.offsetTop;
	obj= obj.offsetParent;
    }
    return topValue;
}

for(a=1;a<last;a++)
   { hh='menu' + a +'0';
     yyy[a]=130;
     ff[a]=0;
     zzz[a]="";
   }


function zoomer(m,f,yy,zz)
{ hd='menu0' + m;
  cibley=130;
  if(zz=='on')
    { cibley=cible[m];
    }
  if(zz=='off')
    { cibley=130;
    }
  g=Math.sin(f*(Math.PI)/36);
  yhd=Math.round((cibley-yy)*g+yy);
  document.getElementById(hd).style.top=yhd+'px';
  ff[m]++;
  if (f==19)
     { zzz[m]="";
     }
 return;
}

function altern()
{ mimg=banpic.length-1;
  if(mimg>=3)
    { limg=0;
      actu1=document.images['ban1'].src.replace('http://www.delta-prefa.com/dataimages/banniere/','');
      actu2=document.images['ban2'].src.replace('http://www.delta-prefa.com/dataimages/banniere/','');
      actu3=document.images['ban3'].src.replace('http://www.delta-prefa.com/dataimages/banniere/','');
      nimg=(Math.floor(3*Math.random()+1));
      limg =(Math.floor(mimg*Math.random()));
      if((banpic[limg]!=actu1)&&(banpic[limg]!=actu2)&&(banpic[limg]!=actu3))
        { document.images['ban'+nimg].src='dataimages/banniere/'+banpic[limg];
        }
    }
  return;
}

function grow()
{ for (a=1;a<last;a++)
      { if(zzz[a]!="") zoomer(a,ff[a],yyy[a],zzz[a]);
      }
  for (b=0;b<logos;b++)
      { ylogo=parseInt(document.getElementById('logos'+b).style.top)+1;
        if (ylogo==65)
           { altern();
           }
        if (ylogo>130)
           { ylogo=-(130*(logos-1));
             altern();
           }

        document.getElementById('logos'+b).style.top=ylogo+'px';
            
      }

  return;
}

function aller(n)
{ if(zzz[n]!="on")
    {zzz[n]="on";
     ff[n]=0;
     hh='menu0' + n;
     yyy[n]= parseInt(document.getElementById(hh).style.top);
    }
  return;
}

function stopper(n)
{ if(zzz[n]!="off")
    {zzz[n]="off";
     ff[n]=0;
     hh='menu0' + n;
     yyy[n]= parseInt(document.getElementById(hh).style.top);
    }
  return;
}

function init()
{ for (a=1;a<5;a++)
    {cible[a]=130-goals[a];
     document.getElementById("menu0"+a).style.top='130px';
    }
  //document.getElementById("temoin").innerHTML=cible[1];
  interval1 = setInterval(grow,delay1);
  return;
}


