function calcRoundHole()
{
	
	//diameter*thickness*3.1416*25

	var errors, diam, thick, retVal;

	//first check the validity of all the numbers
	errors = '';
	diam =(document.Round.RoundDiameter.value);
	if (document.Round.RoundDiameter.value != ''+diam) errors += ' '+document.Round.RoundDiameter.name+' must contain a valid number. Make sure value less than 1 have a zero prior to decimal.\n';
	if (document.Round.RoundDiameter.value < document.Round.RoundThickness.value) errors += 'Hole Diameter must be greater than Material Thickness.\n';
	thick =(document.Round.RoundThickness.value);
	if (document.Round.RoundThickness.value != ''+thick) errors += 'Material Thickness must contain a valid number. Make sure value less than 1 have a zero prior to decimal.\n';
	
	if( errors != '' )
	{
		alert(errors);
		return;
	}


	retVal = diam * thick * 3.1416 * 25;

	retVal *= 100.0;
	retVal = Math.round(retVal);
	retVal /= 100.0;
	
	document.Round.PunchTonnageRound.value = retVal;
     

}

function calcSquareHole()
{
	//(2*sideOne+2*sideTwo)*thickness*25

	var errors, sideOne, sideTwo, thick, tensile, retVal;

	//first check the validity of all the numbers
	errors = '';
	sideOne =(document.Rect.RectSideOne.value);
	if (document.Rect.RectSideOne.value != ''+sideOne) errors += 'Side one must contain a valid number. Make sure value less than 1 have a zero prior to decimal.\n';
	sideTwo =(document.Rect.RectSideTwo.value);
	if (document.Rect.RectSideTwo.value != ''+sideTwo) errors += 'Side two must contain a valid number. Make sure value less than 1 have a zero prior to decimal.\n';
	thick =(document.Rect.RectThickness.value);
	if (document.Rect.RectThickness.value != ''+thick) errors += 'Thickness must contain a valid number. Make sure value less than 1 have a zero prior to decimal.\n';
	
	if( errors != '' )
	{
		alert(errors);
		return;
	}

	retVal = ((2.0 * sideOne ) + ( 2.0 * sideTwo )) * thick * 25;

	retVal *= 100.0;
	retVal = Math.round(retVal);
	retVal /= 100.0;
	
	document.Rect.PunchTonnageSquare.value = retVal;
}


function solvepy(form) {
a = parseFloat(form.a.value);
b = parseFloat(form.b.value);
form.c.value = Math.sqrt(a*a + b*b);
}


function calcTonsPerFoot() {
   var m = document.getElementById("Materialthickness");
   
   if (m.value.match(/^\s*$/)) {
      // display useful error message
      alert("Material thickness is required.");
      // put cursor in offending field
      m.select();
      m.focus();
      // abort
      return false;
   }
   
   if (isNaN(m.value)) {
      // display useful error message
      alert("Material thickness must be a number. You entered " + "\"" + m.value + "\".");
      // put cursor in offending field
      m.select();
      m.focus();
      // abort
      return false;
   }
   
   if (!(m.value > 0)) {
      // display useful error message
      alert("Material thickness must greater than zero.");
      // put cursor in offending field
      m.select();
      m.focus();
      // abort
      return false;
   }
   
   var v = document.getElementById("Veeopening");
   
   if (v.value.match(/^\s*$/)) {
      // display useful error message
      alert("Vee opening is required.");
      // put cursor in offending field
      v.select();
      v.focus();
      // abort
      return false;
   }
   
   if (isNaN(v.value)) {
      // display useful error message
      alert("Vee opening must be a number. You entered " + "\"" + v.value + "\".");
      // put cursor in offending field
      v.select();
      v.focus();
      // abort
      return false;
   }
   
   if (!(v.value > 0)) {
      // display useful error message
      alert("Vee opening must greater than zero.");
      // put cursor in offending field
      v.select();
      v.focus();
      // abort
      return false;
   }
   
   document.getElementById("Tonsperfoot").value = (575 * Math.pow(m.value, 2)) / v.value;
}
