
     On = new Image();	On.src = "./art/on.gif";
     Off = new Image();	Off.src = "./art/off.gif";

function stopclock() {
  if (timerID ) clearTimeout(timerID);
}

function init() {
     brow = "new";
     if (navigator.appName == "Netscape" && navigator.appVersion.charAt(0) < 5) {
     brow = "old";
//alert( navigator.appName + " " + navigator.appVersion.charAt(0) + " is old");  
     }
     if ( brow == "old" ) {
      this.nDIV = eval("document" + ".noyauDIV");
      this.eDIV = eval("document" + ".electronDIV");
     }

//     Packages.EOM.init();         
//     Packages.EOM.plotElectron();   

    document.images["Stop"].src = Off.src;		 document.images["Slow"].src =Off.src;
    document.images["Fast"].src = Off.src;		 document.images["Radial"].src = Off.src;
    document.images["Angular"].src = Off.src;		 document.images["Both"].src = Off.src;
    document.images["Random"].src = Off.src;		 document.images["Ccw"].src =Off.src;
    document.images["Harmonic"].src = Off.src;		 document.images["Cw"].src = Off.src;

     if(rad == 1 && rot == 1) document.images["Both"].src =On.src;
     if(rad == 1 && rot == 0) document.images["Radial"].src =On.src;
     if(rad == 0 && rot == 1) document.images["Angular"].src =On.src;
     if(randomrad == true) document.images["Random"].src =On.src;
     if(randomrad == false && rad == 1) document.images["Harmonic"].src =On.src;
     if(mom == '+') document.images["Ccw"].src =On.src;
     if(mom == '-') document.images["Cw"].src =On.src;
     if(speed == 0) document.images["Stop"].src =On.src;
     if(speed == 1) document.images["Slow"].src =On.src;
     if(speed == 2) document.images["Fast"].src =On.src;

     r = r0;
     phi = p0;
     rinc = dr;
     delphi = dp;
     if(freqindex == 5) {freqrat = 25;
     } else {
          if(freqindex == 0) { freqrat = 1; 
          } else {freqrat = 2*freqindex;
          }
     }
     (mom == "+") ? momentum = 1 : momentum = -1;
     if(speed == 2)  vel = 150;
     if(speed == 1)  vel = 450;
     if (brow == "old") {
       noyauX = parseInt(this.nDIV.left) + 5;
       noyauY = parseInt(this.nDIV.top) + 7;
     } else {
       noyauX = parseInt(document.getElementById('noyauDIV').style.left) + 5;
       noyauY = parseInt(document.getElementById('noyauDIV').style.top) + 7;
     }
     width = 30;
     height = 30;
       if ( brow == "new" ) {
         electronX = parseInt(document.getElementById('electronDIV').style.left);
         electronY = parseInt(document.getElementById('electronDIV').style.top);
       } else { 
         electronX = parseInt(this.eDIV.left);
         electronY = parseInt(this.eDIV.top);
       }
//alert(electronX  + " "  + electronY);
      if(speed != 0) plotElectron();
}

function plotElectron() {
     if ( brow == "old" ) {
       this.eDIV.left = noyauX + r*Math.cos(phi*Math.PI/180) - width/2;
       this.eDIV.top  = noyauY - r*Math.sin(phi*Math.PI/180) - height/2;
     } else {
       document.getElementById('electronDIV').style.left = noyauX + r*Math.cos(phi*Math.PI/180) - width/2;
       document.getElementById('electronDIV').style.top = noyauY + r*Math.sin(phi*Math.PI/180) - height/2;
     }
//  setup next point
    if(rot == 1 && rad == 1) phi += momentum*delphi*freqrat;
    if(rot == 1 && rad == 0) phi += momentum*delphi;
    if(rad == 1) {
         if(randomrad == true) {
              r = r0 * Math.random();
         } else {
              if(r == 0 || r ==  r0) rinc = -1 * rinc;
              r += rinc;
         }
    }
    timerID = setTimeout("plotElectron()",vel);
}

  timerID = 1;
  r0 = 120;
  dr = 20;
  dp = 7.5;
  p0 = 0.0;
  freqindex = 5;
  mom = '+';
  speed = 0;
  mod = ''; 
  rot = 1;
  rad = 1; randomrad = true;
/* Copyright &copy; 1999-2006<br>
		chemed.net &nbsp; All rights reserved.  */