var ch=Math.PI/180
var a=new Array()

var c=new Array()
var d=new Array()
var x
var y
var g=0

var grade=new Array()
var gradeOA=0
var II=0
var JJ=0
var nump=5
msg=open("ins.html","msg","width=320,height=320,toolbar=yes,directories=no,menubar=yes,scrollbars=yes")
msg.document.close()
function pins(obj,obj2){
if(obj2!="0"){
JJ=eval(parseFloat(obj2)-1)
//alert(JJ)

//obj.prob[JJ].checked=false
d[II]=obj2
//alert(d[II])
for(i=0;i<d.length;i++){if(obj2==d[i]){grade[i]=0;}}

document.forms[1].results.value+=obj.result.value
obj.result.value=" "
obj.idx.value=obj2
II=eval(parseFloat(II)+1)

switch(parseFloat(obj2)){

case 1:
x=Math.round(eval(Math.random()*6+2)*10)/10

y=Math.round(eval(Math.random()*6+3)*10)/10

msg.document.images[0].src='rt.gif'
msg.focus()
obj.result.value+='Problem 1:\rIn the figure if a='+x+' and b='+y+', to two decimal place what is c? What is the sin(theta) to three decimal places?'+'\n'+'_____________________'+'\n'
break;

case 2:
x=Math.round(eval(Math.random()*70+10)*1)/1

msg.document.images[0].src='rt.gif'
msg.focus()
obj.result.value+='Problem 2:\rIn the figure if theta equals '+x+' degrees what is phi?'+'\n'+'_____________________'+'\n'
break;

case 3:
x=Math.round(eval(Math.random()*18+2)*1)/1

msg.document.images[0].src='et.gif'
msg.focus()
obj.result.value+='Problem 3:\rIn the equilateral triangle in the figure if each side has length '+x+', what is the area to 1 decimal place?'+'\n'+'_____________________'+'\n'
break;

case 4:
x=Math.round(eval(Math.random()*9+2)*1)/1

z=Math.round(eval(Math.random()*20+20)*1)/1

y=Math.round(eval(Math.random()*20+20)*1)/1

msg.document.images[0].src='t.gif'
msg.focus()
obj.result.value+='Problem 4:\rIn the figure if a='+x+', A='+z+' degrees and B='+y+' degrees, what is b to one decimal place?  '+'\n'+'_____________________'+'\n'
break;

case 5:
z=Math.round(eval(Math.random()*5+1)*10)/10

x=Math.round(eval(Math.random()*5+1)*10)/10

y=Math.round(eval(Math.random()*20+20)*1)/1

msg.document.images[0].src='t.gif'
msg.focus()
obj.result.value+='Problem 5:\rIn the figure b='+z+', c='+x+' and A='+y+', what is \'a\' to one decimal place?'+'\n'+'_____________________'+'\n'
break;
//qqq2










default:
alert("not authored ")
break;
}
JJ=0

}
}
function fit(obj){
gradeOA=parseFloat(0)
for(i=0;i<grade.length;i++){gradeOA+=parseFloat(grade[i])}
gradeOA=eval(gradeOA/nump)
document.forms[1].results.value+="\n"+document.forms[0].result.value

document.forms[0].result.value="Your Grade for this exercise is "+gradeOA
document.forms[1].results.value+="\n"+document.forms[0].result.value
if(document.forms[1].send_to.value!=""&&document.forms[1].email.value!=""){

document.forms[1].send_to.value=document.forms[1].email.value+","+document.forms[1].send_to.value
document.forms[1].subject.value='Trig Test'
document.forms[1].action='http://image-ination.com/cgi-bin/form.pl'
return true
}else{return false}
}

function setFocus() {
        document.evalform2.result.focus();
        return;
}

function compute(obj) {
 var  sd = obj.result.value.split("\r")
 var  ss = eval(sd[sd.length-1])
   obj.result.value +="\r"+eval(ss)
}
function compute2e(obj) {
 var  sd = obj.result.value.split("\r")
 var  ss = eval(sd[sd.length-1])
   obj.result.value +="\r"+"{"+eval(ss)+"}"+"\r"
}
function compute3(obj) {
obj.temp.value=obj.result.value
 var  sd = obj.result.value.split("\r")
 var  ss = eval(sd[sd.length-1])
var nn=prompt("What power","enter here")
   obj.result.value += "\r"+"^3"+"\r"+eval(Math.pow(parseFloat(ss),nn))
}
function compute2(obj) {
obj.temp.value=obj.result.value
 var  sd = obj.result.value.split("\r")
 var  ss = eval(sd[sd.length-1])
   obj.result.value +="\r"+"^2"+"\r"+ eval(Math.pow(parseFloat(ss),2))
}


function computem(obj) {
 var  sd = obj.result.value.split("\r")
 var  ss = sd[sd.length-1]
obj.memory.value=ss
obj.result.value+="\r"+"mem->"+"\r"
}
function computemp(obj) {
 var  sd = obj.result.value.split("\r")
 var  ss = sd[sd.length-1]
   obj.memory.value =eval(parseFloat(obj.memory.value)+parseFloat(ss))
obj.result.value+="\r"+"mem+"+"\r"
}
function computemr(obj) {
obj.temp.value=obj.result.value
   obj.result.value+= obj.memory.value
}


function computesq(obj) {
obj.temp.value=obj.result.value
 var  sd = obj.result.value.split("\r")
 var  ss = eval(sd[sd.length-1])
   obj.result.value += "\r"+"sqrt"+"\r"+eval(Math.pow(parseFloat(ss),.5))
}
function computesi(obj) {
 var  sd = obj.result.value.split("\r")
 var  ss = eval(sd[sd.length-1])
obj.temp.value=obj.result.value
   obj.result.value += "\r"+"sin"+"\r"+eval(Math.sin(ss*ch))
}
function computeas(obj) {
 var  sd = obj.result.value.split("\r")
 var  ss = eval(sd[sd.length-1])
obj.temp.value=obj.result.value
   obj.result.value += "\r"+"asin"+"\r"+eval(Math.asin(ss)/ch)
}
function computeco(obj) {
 var  sd = obj.result.value.split("\r")
 var  ss = eval(sd[sd.length-1])
obj.temp.value=obj.result.value
   obj.result.value += "\r"+"cos"+"\r"+eval(Math.cos(ss*ch))
}

function git(obj,obj2)
{
obj2=parseFloat(obj2)
var b=new Array()

switch(obj2){
case 1:
g=0
a[0]=Math.round(eval(eval(Math.sqrt(parseFloat((eval(Math.pow(parseFloat(parseFloat([x])),2)))+(eval(Math.pow(parseFloat(parseFloat([y])),2)))))))*100)/100;
;b[0]=obj.result.value.split('{')[1].split('}')[0]
c[0]='Use the Pythagorean Theorem. '

a[1]=Math.round(parseFloat([x])/eval(eval(Math.sqrt(parseFloat((eval(Math.pow(parseFloat(parseFloat([x])),2)))+(eval(Math.pow(parseFloat(parseFloat([y])),2)))))))*1000)/1000;
;b[1]=obj.result.value.split('{')[2].split('}')[0]
c[1]=' The sine is the opposite side over the hypotenuse. '
for(j=0;j<b.length;j++){if(Math.abs(parseFloat(a[j])-parseFloat(b[j]))<.01*Math.abs(parseFloat(a[j]))){g+=parseFloat(1);obj.result.value=obj.result.value.replace(/}\s/,'}_correct\r')}else{g+=parseFloat(0);obj.result.value=obj.result.value.replace(/}\s/,'}_wrong\r'+c[j]+'\r'+'The correct answer is '+a[j]+'\r'+'__________'+'\r')}}grade[0]=(g/(b.length))*100;obj.result.value+='\r'+'Your grade on this problem is: '+grade[0]+'\r'+'\r'
break;
case 2:
g=0
a[0]=90-parseFloat([x]);
;b[0]=obj.result.value.split('{')[1].split('}')[0]
c[0]='The angles in a triangle add up to 180 degrees. '
for(j=0;j<b.length;j++){if(Math.abs(parseFloat(a[j])-parseFloat(b[j]))<.01*Math.abs(parseFloat(a[j]))){g+=parseFloat(1);obj.result.value=obj.result.value.replace(/}\s/,'}_correct\r')}else{g+=parseFloat(0);obj.result.value=obj.result.value.replace(/}\s/,'}_wrong\r'+c[j]+'\r'+'The correct answer is '+a[j]+'\r'+'__________'+'\r')}}grade[1]=(g/(b.length))*100;obj.result.value+='\r'+'Your grade on this problem is: '+grade[1]+'\r'+'\r'
break;
case 3:
g=0
a[0]=Math.round(eval(eval(Math.pow(parseFloat(parseFloat([x])),2))*.433012702)*10)/10;
;b[0]=obj.result.value.split('{')[1].split('}')[0]
c[0]='Turn it into two right triangles. '
for(j=0;j<b.length;j++){if(Math.abs(parseFloat(a[j])-parseFloat(b[j]))<.01*Math.abs(parseFloat(a[j]))){g+=parseFloat(1);obj.result.value=obj.result.value.replace(/}\s/,'}_correct\r')}else{g+=parseFloat(0);obj.result.value=obj.result.value.replace(/}\s/,'}_wrong\r'+c[j]+'\r'+'The correct answer is '+a[j]+'\r'+'__________'+'\r')}}grade[2]=(g/(b.length))*100;obj.result.value+='\r'+'Your grade on this problem is: '+grade[2]+'\r'+'\r'
break;
case 4:
g=0
a[0]=Math.round(eval((parseFloat([x])/Math.sin(parseFloat([z])*Math.PI/180))*(eval(Math.sin(parseFloat([y])*Math.PI/180))))*10)/10;
;b[0]=obj.result.value.split('{')[1].split('}')[0]
c[0]='Use the law of Sines '
for(j=0;j<b.length;j++){if(Math.abs(parseFloat(a[j])-parseFloat(b[j]))<.01*Math.abs(parseFloat(a[j]))){g+=parseFloat(1);obj.result.value=obj.result.value.replace(/}\s/,'}_correct\r')}else{g+=parseFloat(0);obj.result.value=obj.result.value.replace(/}\s/,'}_wrong\r'+c[j]+'\r'+'The correct answer is '+a[j]+'\r'+'__________'+'\r')}}grade[3]=(g/(b.length))*100;obj.result.value+='\r'+'Your grade on this problem is: '+grade[3]+'\r'+'\r'
break;
case 5:
g=0
a[0]=Math.round(eval(Math.sqrt((eval(Math.pow(parseFloat(parseFloat([x])),2))+Math.pow(parseFloat(parseFloat([z])),2))-(eval(Math.cos(parseFloat([y])*Math.PI/180))*parseFloat([z])*2*parseFloat([x]))))*10)/10;
;b[0]=obj.result.value.split('{')[1].split('}')[0]
c[0]='Use the Law of Cosines '
for(j=0;j<b.length;j++){if(Math.abs(parseFloat(a[j])-parseFloat(b[j]))<.01*Math.abs(parseFloat(a[j]))){g+=parseFloat(1);obj.result.value=obj.result.value.replace(/}\s/,'}_correct\r')}else{g+=parseFloat(0);obj.result.value=obj.result.value.replace(/}\s/,'}_wrong\r'+c[j]+'\r'+'The correct answer is '+a[j]+'\r'+'__________'+'\r')}}grade[4]=(g/(b.length))*100;obj.result.value+='\r'+'Your grade on this problem is: '+grade[4]+'\r'+'\r'
break;
//qqq5
default:
alert("not authored")
break;

}
}
function computeac(obj) {
 var  sd = obj.result.value.split("\r")
 var  ss = eval(sd[sd.length-1])
obj.temp.value=obj.result.value
   obj.result.value +="\r"+"acos"+"\r"+eval(Math.acos(ss)/ch)
}
function computeta(obj) {
 var  sd = obj.result.value.split("\r")
 var  ss = eval(sd[sd.length-1])
obj.temp.value=obj.result.value
   obj.result.value += "\r"+"tan"+"\r"+eval(Math.tan(ss*ch))
}
function computeat(obj) {
 var  sd = obj.result.value.split("\r")
 var  ss = eval(sd[sd.length-1])
obj.temp.value=obj.result.value
   obj.result.value += "\r"+"atan"+"\r"+eval(Math.atan(ss)/ch)
}
function computeex(obj) {
 var  sd = obj.result.value.split("\r")
 var  ss = eval(sd[sd.length-1])
obj.temp.value=obj.result.value
   obj.result.value += "\r"+"exp"+"\r"+eval(Math.exp(parseFloat(ss)))
}
function computelo(obj) {
 var  sd = obj.result.value.split("\r")
 var  ss = eval(sd[sd.length-1])
obj.temp.value=obj.result.value
   obj.result.value += "\r"+"ln"+"\r"+eval(Math.log(parseFloat(ss)))
}
function computelog(obj) {
 var  sd = obj.result.value.split("\r")
 var  ss = eval(sd[sd.length-1])
obj.temp.value=obj.result.value
   obj.result.value += "\r"+"log"+"\r"+eval(.434294482*Math.log(parseFloat(ss)))
}
function computepi(obj) {
obj.temp.value=obj.result.value
   obj.result.value += eval(Math.PI)
}
function computecl(obj) {
   obj.result.value = obj.temp.value
}
function computemc(obj) {
   obj.result.value += "\r"
}
function compute0(obj) {
obj.temp.value=obj.result.value
   obj.result.value += 0
}
function compute1(obj) {
obj.temp.value=obj.result.value
   obj.result.value += 1
}
function computen2(obj) {
obj.temp.value=obj.result.value
   obj.result.value += 2
}
function computen3(obj) {
obj.temp.value=obj.result.value
   obj.result.value += 3
}
function compute4(obj) {
obj.temp.value=obj.result.value
   obj.result.value += 4
}
function compute5(obj) {
obj.temp.value=obj.result.value
   obj.result.value += 5
}
function compute6(obj) {
obj.temp.value=obj.result.value
   obj.result.value += 6
}
function compute7(obj) {
obj.temp.value=obj.result.value
   obj.result.value += 7
}
function compute8(obj) {
obj.temp.value=obj.result.value
   obj.result.value += 8
}
function compute9(obj) {
obj.temp.value=obj.result.value
   obj.result.value += 9
}
function computeper(obj) {
obj.temp.value=obj.result.value
   obj.result.value += "."
}
function computee(obj) {
obj.temp.value=obj.result.value
   obj.result.value += "e"
}
function computeleft(obj) {
obj.temp.value=obj.result.value
   obj.result.value += "("
}
function computeright(obj) {
obj.temp.value=obj.result.value
   obj.result.value += ")"
}
function computeplu(obj) {
obj.temp.value=obj.result.value
   obj.result.value += "+"
}
function computemin(obj) {
obj.temp.value=obj.result.value
   obj.result.value += "-"
}
function computemul(obj) {
obj.temp.value=obj.result.value
   obj.result.value += "*"
}
function computediv(obj) {
obj.temp.value=obj.result.value
   obj.result.value += "/"
}

function computeInsert(obj){
document.forms[0].temp.value=document.forms[0].result.value
var ins=prompt("What is your comment?","enter here")
document.forms[0].result.value+="\r"+"--------"+"\r"+ins+"\r"+"--------"+"\r"
}

function computecall(obj){

if(confirm("Are you sure you want to clear the whole record?\nIt is 'undoable' using the clear key if you change your mind.")){
obj.temp.value=obj.result.value
obj.result.value=" "
}
}

