<!--
/*
	Copywrite 1997-2001 by Mark I. Medina, Mark@4lo.com
	Please do not use this code.
	
	Version 2.0, 4/20/2001 - Compatible with Netscape 3.x+ and MSIE 3.0+ 
	
	You may use a limited (and easier) version 1.0 by placing a
	link back to http://www.4Lo.com and giving Mark I. Medina credit.
	Get the code by pointing your browser to http://www.4Lo.com/4LoCalc.htm
	and copy the source code to your site, leave all comments in place and
	please send me an email at Mark@4Lo.com with the calc web address.

*/

function  isNumb(passStr) {
 	var regEx  =  /(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/; 
 	return regEx.test(passStr);
}

function gearcalc(form_obj) {
	for (cnt=0; cnt < form_obj.elements.length; cnt++) {
		if (!isNumb(form_obj.elements[cnt].value.toString()) && form_obj.elements[cnt].type == "text") {
			form_obj.elements[cnt].value = "";
		}
	} 

	if (form_obj.ngr.value.toString()==""&&form_obj.rgc.value.toString()>""&&form_obj.pgc.value.toString()>"") {
	   form_obj.ngr.value = Math.round((form_obj.rgc.value.toString()/form_obj.pgc.value.toString())*100)/100;
       return;
	}

	if (form_obj.pgc.value.toString()==""&&form_obj.rgc.value.toString()>""&&form_obj.ngr.value.toString()>"") {
	   form_obj.pgc.value = Math.round((form_obj.rgc.value.toString()/form_obj.ngr.value.toString())*100)/100;
       return;
	}
	
	if (form_obj.rgc.value.toString()==""&&form_obj.pgc.value.toString()>""&&form_obj.ngr.value.toString()>"") {
	   form_obj.rgc.value = Math.round((form_obj.pgc.value.toString()*form_obj.ngr.value.toString())*100)/100;
       return;
	}
}

//end -->