function trim(val)
{
	return val.replace(/^[\s\t]*/, "").replace(/[\s\t]*$/, "");
}
						
function isNumeric(val)
{
	// Check against a regular expression
	return (/^[\s\t]*-?[0-9]+((.[0-9]+)|)[\s\t]*$/.test(val));
}

function isInteger(val)
{
	if (!isNumeric(val)) {
		// If it's not numeric then it certainly isn't an integer
		return false;
	}
	
	// Check that the integer part is the whole of the number
	var trimmedVal = trim(val);
	var intPart = parseInt(trimmedVal);
	return (trimmedVal.length == intPart.toString().length);					
}
