﻿ function calcTrail() {    if(document.form1.wbase.value == "") {		alert("Please enter wheelbase in inches!")		document.form1.wbase.focus()		return false	}	if(document.form1.tirediam2.value == "") {		alert("Please enter rear tire diameter in inches!")		document.form1.tirediam2.focus()		return false	}	if(document.form1.tirediam.value == "") {		alert("Please enter a front tire diameter in inches!")		document.form1.tirediam.focus()		return false	}	if(document.form1.rake.value == "") {		alert("Please enter a steering head rake in degrees!")		document.form1.rake.focus()		return false	}	if(document.form1.offset.value == "") {		alert("Please enter an offset value in inches!")		document.form1.offset.focus()		return false	}	if(document.form1.length1.value == "") {		alert("Please enter length of front forks in inches!")		document.form1.length1.focus()		return false	}	if(document.form1.tripletree.value == "") {		alert("Please enter triple tree rake in degrees!")		document.form1.tripletree.focus()		return false	}	if(document.form1.length2.value == "") {		alert("Please enter new fork length in inches!")		document.form1.length2.focus()		return false	}	raker = ((document.form1.rake.value * 1) / 180) * Math.PI	tripletreer = ((document.form1.tripletree.value * 1) / 180) * Math.PI	fork1 = (document.form1.rake.value * 1) +  (document.form1.tripletree.value * 1)	fork1r = (fork1 / 180) * Math.PI	centerline1 = document.form1.wbase.value * 1	d = Math.cos(raker) * (document.form1.offset.value * 1)	b = Math.sin(fork1r) * (document.form1.length1.value * 1)	c1 = Math.cos(fork1r) * (document.form1.length1.value * 1)	c = c1 - (Math.sin(raker) * (document.form1.offset.value * 1))	a = c + ((document.form1.tirediam.value * 1) / 2)	e = Math.tan(raker) * (a * 1)	trail1 = e - (b + d)	f = (document.form1.wbase.value * 1) - (b + d)	g2 = (f * f) + (c * c)	g = Math.sqrt(g2)	h = ((document.form1.tirediam.value * 1) / 2) + (Math.cos(raker) * (document.form1.length1.value * 1))    i = (document.form1.length2.value * 1) - (document.form1.length1.value * 1)    j = ((90 / 180) * Math.PI) + fork1r    k = document.form1.wbase.value * 1    l = ((k * k) + (i * i)) - (2 * ((k * i) * (Math.cos(j))))    m = Math.sqrt(l)    sinb = (i * Math.sin(j)) / m    anglenew = (Math.asin(sinb) * 180) / Math.PI    s = anglenew    rake2 = (document.form1.rake.value * 1) + anglenew    fork2 = fork1 + anglenew    rake2r = (rake2 / 180) * Math.PI    fork2r = (fork2 / 180) * Math.PI    dd = Math.cos(rake2r) * (document.form1.offset.value * 1)    bb = Math.sin(fork2r) * (document.form1.length2.value * 1)    cc1 = Math.cos(fork2r) * (document.form1.length2.value * 1)    cc = cc1 - (Math.sin(rake2r) * (document.form1.offset.value * 1))    aa = cc + ((document.form1.tirediam.value * 1) / 2)    ee = Math.tan(rake2r) * (aa * 1)    trail2 = ee - (bb + dd)	test = trail1	test1 = g	test2 = centerline1	test3 = a	test4 = fork2	test5 = trail2	test6 = m	test7 = g	test8 = m	test9 = aa	test10 = fork1	test11 = rake2		tempj = Math.round(test * 100)	tempj1 = Math.round(test1 * 100)	tempj2 = Math.round(test2 * 100)	tempj3 = Math.round(test3 * 100)	tempj4 = Math.round(test4 * 100)	tempj5 = Math.round(test5 * 100)	tempj6 = Math.round(test6 * 100)	tempj7 = Math.round(test7 * 100)	tempj8 = Math.round(test8 * 100)	tempj9 = Math.round(test9 * 100)	tempj10 = Math.round(test10 * 100)	tempj11 = Math.round(test11 * 100)	tempk = tempj * .01	tempk1 = tempj1 * .01	tempk2 = tempj2 * .01	tempk3 = tempj3 * .01	tempk4 = tempj4 * .01	tempk5 = tempj5 * .01	tempk6 = tempj6 * .01	tempk7 = tempj7 * .01	tempk8 = tempj8 * .01	tempk9 = tempj9 * .01	tempk10 = tempj10 * .01	tempk11 = tempj11 * .01	daRatio = parseInt(tempk * 100) / 100	daRatio1 = parseInt(tempk1 * 100) / 100	daRatio2 = parseInt(tempk2 * 100) / 100	daRatio3 = parseInt(tempk3 * 100) / 100	daRatio4 = parseInt(tempk4 * 100) / 100	daRatio5 = parseInt(tempk5 * 100) / 100	daRatio6 = parseInt(tempk6 * 100) / 100	daRatio7 = parseInt(tempk7 * 100) / 100	daRatio8 = parseInt(tempk8 * 100) / 100	daRatio9 = parseInt(tempk9 * 100) / 100	daRatio10 = parseInt(tempk10 * 100) / 100 	daRatio11 = parseInt(tempk11 * 100) / 100  	document.form1.ratio.value = daRatio	document.form1.ratio1.value = daRatio1	document.form1.ratio2.value = daRatio2	document.form1.ratio3.value = daRatio3	document.form1.ratio4.value = daRatio4	document.form1.ratio5.value = daRatio5	document.form1.ratio6.value = daRatio6	document.form1.ratio7.value = daRatio7	document.form1.ratio8.value = daRatio8	document.form1.ratio9.value = daRatio9	document.form1.ratio10.value = daRatio10 	document.form1.ratio11.value = daRatio11  }