function ValueValidation(entered, min, max, alertbox, datatype)
{
// Checking if the content is a number in a limited range.
// Optional parameters are:
// min --minimum value allowed in the field.
// max --maximum value allowed in the field.
// text --text that will show in an alertbox if content is illegal.
// type --enter "I" if only integers are allowed.
with (entered)
{
checkvalue=parseFloat(value);
if (datatype)
{smalldatatype=datatype.toLowerCase();
if (smalldatatype.charAt(0)=="i") {checkvalue=parseInt(value)};
}
if ((parseFloat(min)==min && checkvalue<min) || (parseFloat(max)==max && checkvalue>max) || value!=checkvalue)
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
} 
