changes:
1 was based on a much earlier version found in Ejs default examples by W. Christian and F. Esquembre
2 added alpha = d(omega)/dt = d2(theta)/dt2 into the model's visualization
3 added color scheme consistent with all my usual simulations
4 added velocity visualization
5 added context of ceiling
6 made the codes show pendulum consistently for different length L
26 August 2011
added special menu drop from g following Phet design http://phet.colorado.edu/sims/pendulum-lab/pendulum-lab_en.html Pendulum Lab by PhET
added Fdrag = k*omega to simulate air resistance
added time step to allow slow down observation
add forces mg and tension
add energy bars
add theory pendulum Periodtheory = 2*Math.PI*Math.sqrt(L/g);  from http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=1610.0 Pendulum (Why the angle need to be less than 5 degree --- is it necessary?) by Fu-Kwun Hwang
add counter to calculate number of complete periods using numberofswing = Math.floor(n1/2);
if(omega*omegas<0){
n1++;

if(n1%2.==0.){
 T1[nc]=t-ts;
ts= t;
}
// else T1[nc]=t*2.;// first half period

}
omegas = omega; // to store value of omega
add code to prevent program crashing if (numberofswing>=20.) _pause(); // to prevent error in T1[100] array
add PE ref to illustrate like tracker can, the meaning of arbitrary reference level

enjoy a new and improved simulation!