// Copyright 1999 David Bourne david@boomer.orgvar kel;var cpmax;var vd;var weight;function c1607a(form1){	document.form1.cpmax.value = roundit((40-4)*Math.random()+4,2);	document.form1.cpmin.value = roundit((3.5-0.25)*Math.random()+0.25,2);		document.form1.vd.value = roundit((1.2-0.05)*Math.random()+0.05,3);	document.form1.km.value = roundit((0.1-0.005)*Math.random()+0.005,2);	document.form1.dslope.value = roundit((0.01-0.001)*Math.random()+0.001,2);	document.form1.weight.value = roundit(Math.round((120-25)*Math.random()+25),3);	document.form1.age.value = roundit((65-18)*Math.random()+18,2);	document.form1.serumcr.value = roundit((3-0.4)*Math.random()+0.4,3);	if (Math.random() > 0.5)	{		document.form1.sex[0].checked = false;		document.form1.sex[1].checked = true;	}	else	{		document.form1.sex[0].checked = true;		document.form1.sex[1].checked = false;	}		document.form1.crcl.value = "";	document.form1.kel.value = "";	document.form1.r.value = "";	document.form1.tau.value = "";	document.form2.r.value = "";	document.form2.tau.value = "";	document.form2.mdose.value = "";	document.form2.tau1.value = "";	document.form2.ldose.value = "";	}function ckt(form1){	if (document.form1.cpmax.value.length< 1)	{		alert ("Please enter a Cpmax value");		return false;	}	cpmax   = document.form1.cpmax.value; 	cpmin   = document.form1.cpmin.value;	vd      = document.form1.vd.value;	km      = document.form1.km.value;	dslope  = document.form1.dslope.value;	weight  = document.form1.weight.value;	age     = document.form1.age.value;	serumcr = document.form1.serumcr.value;	if (document.form1.sex[0].checked == true)	{		sex = 1.0;	}	else	{		sex = 0.85;	}	crcl = ((140-age)*weight*sex)/(72.0*serumcr);	kel = 1.0*km + dslope*crcl;	r = cpmin/cpmax;	tau = Math.log(cpmax/cpmin)/kel;	document.form1.crcl.value = roundit(crcl,3);	document.form1.kel.value  = roundit(kel,3);	document.form1.r.value  = roundit(r,4);	document.form1.tau.value  = roundit(tau,3);}function ml(form2){	if (document.form2.tau.value.length< 1)	{		alert ("Please enter a new Tau value");		return false;	}	tau = document.form2.tau.value;	r = Math.exp(-1.0*kel*tau);	mdose = cpmax*vd*weight*(1-r);	ldose= cpmax*vd*weight;document.form2.r.value  = roundit(r,4);	document.form2.mdose.value  = roundit(mdose,3);	document.form2.ldose.value  = roundit(ldose,3);	document.form2.tau1.value  = roundit(tau,3);	}function roundit(a,b)// a is value and b is number of significant digits returned{         c = b - Math.round(0.5 + (Math.log(a)/Math.log(10)));         c = Math.pow(10,c);         c = Math.round(c*a)/c;         return c;}
