
function isDigit(c)
{
	var test = "" + c;
	if (test == "0" || test == "1" || test == "2" || test == "3" || test == "4" || test == "5" || test == "6" || test == "7" || test == "8" || test == "9" || test == ".")
	{
		return true;
	}
	return false;
}

function isAllDigits(s)
{
	var test = "" + s;
	if (test.length == 0)
	{
		return false;
	}
	for (var k = 0; k < test.length; k++)
	{
		var c = test.substring(k, k+1);
		if (isDigit(c) == false)
		{
			return false;
		}
	}
	return true;
}

function updatetable (form)
{
    $('product_table').style.display = 'none';              

	var graph = form.graph.options[form.graph.selectedIndex].value; 			//	0 = pressure, 1 = vacuum
	var pValue = form.pressure.value;               //	numbers
	var pUnit = form.pressure_unit.options[form.pressure_unit.selectedIndex].value;   //	0 = m3/h, 1 = CFM
	var vValue = form.volume.value;                 //	numbers
	var vUnit = form.volume_unit.options[form.volume_unit.selectedIndex].value;     //	0 = millibars, 1 = PSI

	if((isAllDigits(pValue) && isAllDigits(vValue)))
	{                                                  
		data = 'graph=' + graph + '&pValue=' + pValue + '&pUnit=' + pUnit + '&vValue=' + vValue + '&vUnit=' + vUnit; 
		render_view('product_formula', 'product_table', data); 
		Effect.Appear('product_table', { duration: 2 });    
	}
	else
	{
		Effect.Fade('product_table', { duration: 0.5 }); 	
	}
}  