/*
Science & Engineering Encyclopaedia. Copyright Dirac Delta Consultants Ltd. 2001-2002

No part of this document may be reproduced or transmitted in any form or by any mean, electronic or mechanical, including printing, placing on the internet or by any information storage and retrieval system without permission from the Publisher in writing
*/

var xnm=3
var ynm=0
xnme = new Array(xnm)
ynme = new Array(ynm)
xtxt = new Array(xnm)
ytxt = new Array(ynm)
xunt = new Array(xnm)
yunt = new Array(ynm)
xvrb = new Array(xnm)
yvrb = new Array(ynm)


frm="tanfunct"
scrp="tancalc"
ttle="Tangent"
xnme[1]="deg"
xtxt[1]="Angle, °"
xunt[1]="°"
xnme[2]="rad"
xtxt[2]="Angle, radians"
xunt[2]="radians"
xnme[3]="tanof"
xtxt[3]="tangent"
xunt[3]=""


function tancalc(){
degtxt=document.tanfunct.deg.value
radtxt=document.tanfunct.rad.value
tanoftxt=document.tanfunct.tanof.value

xvrb[1]=parseFloat(degtxt)
xvrb[2]=parseFloat(radtxt)
xvrb[3]=parseFloat(tanoftxt)




if (degtxt.length==0) {
	if (tanoftxt.length==0) {
		xvrb[1]=180*xvrb[2]/3.1415926535897932
		xvrb[3]=Math.tan(xvrb[2])
		document.tanfunct.deg.value=xvrb[1]
		document.tanfunct.tanof.value=xvrb[3]
	}

	if (radtxt.length==0) {
		xvrb[2]=Math.atan(xvrb[3])
		xvrb[1]=180*xvrb[2]/3.1415926535897932
		document.tanfunct.rad.value=xvrb[2]
		document.tanfunct.deg.value=xvrb[1]
	}
}

if (radtxt.length==0) {
	if (tanoftxt.length==0) {
		xvrb[2]=3.1415926535897932*xvrb[1]/180
		xvrb[3]=Math.tan(xvrb[2])
		document.tanfunct.rad.value=xvrb[2]
		document.tanfunct.tanof.value=xvrb[3]
	}

	if (degtxt.length==0) {
		xvrb[2]=Math.atan(xvrb[3])
		xvrb[1]=180*xvrb[2]/3.1415926535897932
		document.tanfunct.rad.value=xvrb[2]
		document.tanfunct.deg.value=xvrb[1]
	}
}

if (tanoftxt.length==0) {
	if (radtxt.length==0) {
		xvrb[2]=3.1415926535897932*xvrb[1]/180
		xvrb[3]=Math.tan(xvrb[2])
		document.tanfunct.rad.value=xvrb[2]
		document.tanfunct.tanof.value=xvrb[3]
	}

	if (degtxt.length==0) {
		xvrb[3]=Math.tan(xvrb[2])
		xvrb[1]=180*xvrb[2]/3.1415926535897932
		document.tanfunct.tanof.value=xvrb[3]
		document.tanfunct.deg.value=xvrb[1]
	}
}

}
