//regexp.js
/*

To create a new patterchecker - say to validate credit cards - copy an existing function, 
rename it and place the new pattern between the two '/' characters.

A good resource for these patterns is at: http://regexlib.com/

*/

/*******************************************/

//Parent function, all other functions "inherit" this one.

function checkFields(strCheck, objPattern){
	var objRXP=new RegExp(objPattern);
	return(objRXP.test(strCheck));
}
/******************************************/
		
function isEmail(strCheck){		
	objPat = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;			
	return(checkFields(strCheck, objPat))		
}
		
function isInteger(strCheck){
	objPat = /^[-]?(0+[1-9]|[1-9])[0-9]*$/;			
	return(checkFields(strCheck, objPat))
}
		
function isNumeric(strCheck){
	objPat = /^[-]?[0-9.,]*$/;			
	return(checkFields(strCheck, objPat))
}
		
function isValidString(strCheck){
	objPat = /^[a-zA-Z0-9'-:, ]*$/;			
	return(checkFields(strCheck, objPat))
}
function isValidCompanyName(strCheck){
	objPat = /^[a-zA-Z0-9'-:&, ]*$/;			
	return(checkFields(strCheck, objPat))
}