// (c) Cirris Systems Corp. Script by JaB

// This function is for 400V to 3000V
function VoltsToAirGap_PointToPlane(Volts)
{
  var Gap;
	Gap = (-3.0E-14 * Math.pow(Volts,3)) + (6.0E-10 * Math.pow(Volts,2)) + (5.85E-6 * Volts) - 0.0014;
  if (Gap < 0)
	{
	  Gap = 0;
	}
  Gap = Math.round(Gap * 1000) / 1000;
	return Gap;
}

// This function is for 400V to 3000V
function VoltsToAirGap_PlaneToPlane(Volts)
{
  var Gap;
	if (Volts < 700)
	{
	  Gap = VoltsToAirGap_PointToPlane(Volts);
	}
	else if (Volts < 1150)
	{
    Gap = (0.0006 * Volts + 0.59) * VoltsToAirGap_PointToPlane(Volts);
	}
	else
	{
	  Gap = (0.0021 * Volts - 1.2229) * VoltsToAirGap_PointToPlane(Volts);
	}
	
  Gap = Math.round(Gap * 1000) / 1000;
	return Gap;
}

function VoltsToHeGap_PointToPlane(Volts)
{
  var Gap;
	Gap = ((5.4E-11 * Math.pow(Volts,3)) + (0.00018 * Volts) - 0.055458);
  if (Gap < 0)
	{
	  Gap = 0;
	}
  Gap = Math.round(Gap * 1000) / 1000;
	return Gap;
}

function DCtoAC(Volts)
{
  return Math.round(Volts / 1.414);
}

function InchesToMillimeters(TheInches)
{
  return Math.round(TheInches * 25.4 * 100) / 100;
}

