function addbookmark()
{
if (document.all)
{window.external.AddFavorite(document.location,document.title)}
}

var clockID=0
function UpdateClock()
{
if (clockID)
{clearTimeout(clockID);
clockID = 0;}

var H,M,S,Mth,Day,AMPM,Yr
var tDate = new Date();
Day=tDate.getDate()
if (Day<10)
{Day="0"+Day;}

Mth=tDate.getMonth()+1
if (Mth==1){Mth="Jan"}
if (Mth==2){Mth="Feb"}
if (Mth==3){Mth="Mar"}
if (Mth==4){Mth="Apr"}
if (Mth==5){Mth="May"}
if (Mth==6){Mth="Jun"}
if (Mth==7){Mth="Jul"}
if (Mth==8){Mth="Aug"}
if (Mth==9){Mth="Sep"}
if (Mth==10){Mth="Oct"}
if (Mth==11){Mth="Nov"}
if (Mth==12){Mth="Dec"}

Yr=tDate.getFullYear()

H=tDate.getHours();
if (H>11)
{AMPM="pm";}
else
{AMPM="am";}

if (H>12)
{H=H-12;}

if (H<10)
{H="0"+H;}

M=tDate.getMinutes()
if (M<10)
{M="0"+M;}

S=tDate.getSeconds()
if (S<10){S="0"+S;}

theTime.innerHTML = Day + " " + Mth + " " + Yr + "::"
+ H + ":" + M + ":" + S + AMPM;
clockID = setTimeout("UpdateClock()",1000);
}

function StartClock() {
clockID = setTimeout("UpdateClock()",1000);
}

function KillClock() {
if (clockID)
 {clearTimeout(clockID);
 clockID = 0;}
}

function GetResults()
{
var str=SD.textarea.value;
var tot=0;
for (i=0;i<str.length-1;i++)
{if (str.charAt(i)==" "){tot++}
}
if (tot==0){alert("You must input at least two numbers");SD.textarea.focus();return false;}

for (i=0;i<str.length-1;i++)
{if (str.charAt(i)==" " & str.charAt(i+1)==" "){alert("Only ONE space between numbers, please!");SD.textarea.focus();return false;}
}
if (str.charAt(0)==" "){alert("No spaces at beginning, please!");SD.textarea.focus();return false;}
if (str.charAt(str.length-1)==" "){alert("No spaces at the end, please!");SD.textarea.focus();return false;}
var tot,vary1;
tot=0;max=0;

for (i=0;i<SD.decimal.length;i++)
{if (SD.decimal[i].selected){deci=i;}
}

var arr=str.split(" ");
min=eval(arr[0]);
for (i=0;i<arr.length;i++)
{tot=tot+eval(arr[i]);
if (max<eval(arr[i])){max=eval(arr[i]);}//find highest number
if (min>eval(arr[i])){min=eval(arr[i]);}//find lowest number
}
m=eval((tot/arr.length));
var dataItem=new Array(i);
var vary,std;
vary=0;

for (i=0;i<arr.length;i++)
{dataItem[i]=eval(arr[i]);
vary=vary+Math.abs(dataItem[i]-m)*Math.abs(dataItem[i]-m);}
vary1=(vary/arr.length);
std=Math.sqrt(vary1);

mean.innerHTML="1). Arithmetic Mean (Average) = "+m.toFixed(deci);
variance.innerHTML="2). Variance = "+vary1.toFixed(deci);

stdev1.innerHTML="3). If a normal distribution, 1 standard deviation from the mean is &plusmn"+std.toFixed(deci)+" which means 68% of values should fall between "+Math.abs(m-std).toFixed(deci)+" and "+Math.abs(m+std).toFixed(deci);

stdev2.innerHTML="4). If a normal distribution, 2 standard deviations from the mean is &plusmn"+(std*2).toFixed(deci)+" which means 95% of values should fall between "+Math.abs(m-(std*2)).toFixed(deci)+" and "+(m+Math.abs(std*2)).toFixed(deci);

range.innerHTML="5). Data range: "+min+" to "+max+" ="+(max-min+1)+" (inclusive)";

comment1.innerHTML="6). The more widely dispersed the data the greater the range; the higher is the variance and standard deviation.";
 comment2.innerHTML="7). The more similar is the data the narrower the range; the lower is the variance and standard deviation."
}

 function putFocus(formInst, elementInst)
{
document.forms[0].elements[2].focus();
 }

