<!--
var bname = navigator.appName;
var pgnm = "g41a-placevalues";
var ans = 0;
var wnm = "";
var abpg = "abpg.htm";
var spm1 = "mailto:mathclass@alta";
var spm2 = "vista.com";

function send(subj){parent.location = spm1 + spm2 + '?subject=' + subj + pgnm}

function wnopen(wnm, pgname){
var scrh=(.8*screen.availHeight);
var scrw=(.8*screen.availWidth);
if (wnm=="n"){
nwwin = window.open(pgname, "_blank", "width=" + scrw + ",height=" + scrh + ",status=yes,resizable=yes"); 
nwwin.focus();
}
else {parent.location = pgname}
}
var dir="up";var excount=0;var oldcount=0;var gme=0;var rptdun=0;var limit=1000;
var dlimit=1000;var tlimit=20;var timestart=60;var tmeout;
function maxscore(){if (gme==1){
if (document.play1.gme1max.value < (correct-wrong)){alert("Great!!! You set a new record.");
document.play1.gme1max.value=(correct-wrong)}}
else if (gme==2){if (document.play1.gme2max.value < (correct-wrong)){
alert("Wow!!! A new record.");
document.play1.gme2max.value=(correct-wrong)}}
else if (gme==3){if (document.play1.gme3sec.value > (count-1)){
alert("Congratulations! That is the best time yet.");
document.play1.gme3sec.value=(count);}}}
function startTimer(){correct=0;
document.form1.right.value = correct;
wrong=0;
document.form1.wrong.value = wrong;
var tme= new Date();
hrs= tme.getHours();
mns= tme.getMinutes();
scs= tme.getSeconds();
strttme=hrs*3600+mns*60+scs;  
clck();}
function clck(){
var tme= new Date();
hrs= tme.getHours();
mns= tme.getMinutes();
scs= tme.getSeconds();
nowtme=hrs*3600+mns*60+scs;
totaltme();}
function totaltme(){
if (dir=="up"){count = nowtme - strttme;
if ((correct-wrong)>dlimit){
alert("You completed " + tlimit + " questions in " + count + " seconds");
dlimit=1000;
window.clearTimeout(tmeout);
maxscore();
wnopen('s','#section3');
gme=0;strt();}}
else { count = (timestart + strttme - nowtme)
if (count<1){
if (rptdun==0){
alert("your score is " + (correct - wrong))	
rptdun=1;
window.clearTimeout(tmeout);
maxscore();
wnopen('s','#section3');
gme=0;dir="up";strt();}}}
excount=(correct-wrong-oldcount);
if (gme==2){timestart = (timestart + excount)}
oldcount=(correct-wrong);
if (count > 3600){hour = parseInt(count/3600)}else{hour = 0};
if (count > 60){minut = parseInt(count/60)}	else{minut = 0};
if (minut < 10){minut = "0" + minut};
sec = parseInt(count - minut*60);
if (sec < 10){sec = "0" + sec};
document.tmr.cntr.value = minut + ":" + sec;
tmeout=window.setTimeout("clck()",1000);}
function countdown(){rptdun=0; correct=0; wrong=0; excount=0; oldcount=0; timestart=60; dir='down'; gme=1; wnopen('s','#section2');startTimer();}
function givemetime(){rptdun=0; correct=0; wrong=0; excount=0; oldcount=0; timestart=60; dir='down'; gme=2; wnopen('s','#section2');startTimer();}
function twentyquestions(){dlimit=19;tlimit=20;rptdun=0; correct=0; wrong=0; excount=0; oldcount=0; dir='up'; gme=3; wnopen('s','#section2');startTimer();}
opr = " + ";
var temp_str = ""; 
var correct = 0;
var wrong = 0;
var Answer = "";
var clicked = 0;
var lownumb=1;
var rnge=99;
var maxValue=(rnge+lownumb+1);
var num=new Array(200);
var wrds=new Array("Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten");
var j=201;
var optn=1;
var numA =1; var numB = 1; var numC =1; var numD = 1;

var temp_str = ""; 
var correct = 0;
var wrong = 0;
var Answer = "";
var clicked = 0;
var tnum=0;
var nmill=0; var ansm=0;
var nhthsnd=0; var ansa=0;
var ntthsnd=0; var ansb=0;
var nthsnd=0; var ansc=0;
var nhund = 0; var ansd=0;
var ntens = 0; var anse=0;
var ndigits = 0; var ansf=0;
var lownumb=1;
var rnge=9999998;
var maxValue=(rnge+lownumb+1);
var num=new Array(200);
var wrds=new Array("Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten");
var j=201;
var optn=1;
var numA =1; var numB = 1; var numC =1; var units="";

function rand_array(maxValue){
adjrnge=rnge+1;
num[0]=Math.floor(adjrnge*Math.random()+lownumb);
for (i=1; i<201; i++) {num[i]=Math.floor(adjrnge*Math.random()+lownumb);
if (num[i]==num[i-1]) {while (num[i]==num[i-1]) {
num[i]=Math.floor(adjrnge*Math.random()+lownumb);
}}}}

function do_prob(){

numC=num[j];
j++;
nmill=Math.floor(numC/1000000);
tnum=nmill*1000000;
nhthsnd=Math.floor((numC-tnum)/100000);
tnum=tnum+nhthsnd*100000;
ntthsnd=Math.floor((numC-tnum)/10000);
tnum=tnum+ntthsnd*10000
nthsnd=Math.floor((numC-tnum)/1000);
tnum=tnum+nthsnd*1000
nhund=Math.floor((numC-tnum)/100);
tnum=tnum+nhund*100
ntens=Math.floor((numC-tnum)/10);
tnum=tnum+ntens*10
ndigits=Math.floor(numC-tnum);
document.form1.ques.value = numC;
numA=Math.floor(num[j]/1000000)
if (numA<1){document.form1.ques2.value=("ones"); Answer=ndigits; units=("ones")}
else if (numA<3){document.form1.ques2.value=("tens"); Answer=ntens; units=("tens")}
else if (numA<4){document.form1.ques2.value=("hundreds"); Answer=nhund; units=("hundreds")}
else if (numA<5){document.form1.ques2.value=("thousands"); Answer=nthsnd; units=("thousandths")}
else if (numA<7){document.form1.ques2.value=("ten thousands"); Answer=ntthsnd; units=("ten thousandths")}
else if (numA<8){document.form1.ques2.value=("hundred thousands"); Answer=nhthsnd;units=("hundred thousands")}
else {document.form1.ques2.value=("millions"); Answer=nmill; units=("millions")}
clicked=0;
if (j>198){
   rand_array(maxValue);
   j=1;
   }
}

function strt(){
   rand_array(maxValue);
   j=2;
   document.form1.pctright.value = "";
   document.form1.result1.value = "";
   ansa = 10;
   ansb = 10;
   ansc = 10;
	 startTimer();
   do_prob();
}

function chck(){
if (clicked==0){
   if (Answer == ans){
   correct==correct++;
   document.form1.result1.value = "Correct!";
   document.form1.right.value = correct;
}
   else{
   wrong++;
   document.form1.result1.value =("The number " + numC + " has " + Answer + " " + units);
   alert("The number " + numC + " has " + Answer + " " + units);
   document.form1.wrong.value = wrong;
   clicked=1;
}
totl=correct+wrong;
prctright=Math.floor(correct/totl*100);
document.form1.pctright.value=Math.floor(correct/totl*100);
   ansa = 10;
   ansb = 10;
   ansc = 10;
do_prob();
}
}

// -->
