function RegExpValidator(controlToValidate, message, expr, errorFieldId)
{
	control = document.getElementById(controlToValidate);
	regularExpression = new RegExp(expr);
	if (regularExpression.test(control.value))
	{
	}
	else
	{
		alert(message);
		control.focus();
		control.select();
	}
} 

function TestAll()
{
	RegExpValidator('ConsumoAnnuo','Il valore inserito non è numerico','^[\\d]+(\\.\\d+)?$','');
	RegExpValidator('PrezzoBase','Il valore inserito non è numerico','^[\\d]+(\\.\\d+)?$','');
	RegExpValidator('KWpPannelli','Il valore inserito non è numerico','^[\\d]+(\\.\\d+)?$','');
	RegExpValidator('PrezzoImpianto','Il valore inserito non è numerico','^[\\d]+(\\.\\d+)?$','');
	RegExpValidator('TariffaEnel','Il valore inserito non è numerico','^[\\d]+(\\.\\d+)?$','');
}

