function IsNumber(field,start,end)
{
	//Check if value is not a number
	if(isNaN(field.value))
		return false;
	
	//if start and end are defined
	//check if the number is between them
	if(start && end)
	{		
		if(field.value >= start && field.value <= end)
			return true;
	}
	else
		return true;
}

function MaxSize(field,num)
{
	//if length of data is > than max,
	//make it shorter
	if(field.value.length > num)
		field.value = field.value.substr(0,num);	
}


function IsEmail(field)
{
	//this is a regular expression
	var expr = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	
	if(expr.test(field.value))
		return true;
		
	return false;
}


function Highlight(obj,col)
{
	//just set the bgcolor of obj to col
	obj.style.backgroundColor = col;	
}
