/*
	id naming conventions on forms (rne forbidden and _ )
	
	all with an object start with "rs" will be checked if empty, white spaces is allowed
	
	all with an object start with "r" will be checked if empty, white spaces is not allowed

	a "-XX" means the object must meet the minimum XX character size

	an object that starts with "rp1" will be checked if empty password (will also check against "rp2" value)

	an object that starts with "rp2" will be checked if empty confirm password (will also check against "rp1" value)
	
	all with an object start with "f" will be checked if floating
	
	all with an object start with "i" will be checked if integer
	
	all with an object start with "z" will be checked if integer allow a value of zero
	
	all with an object start with "e" will be checked if email
	
	all with an object start with "url" will be checked if url link
	
	all with an object start with "d" will be checked if date value / will correct the date value appropriately
	
	checkrequired(form, func.value, skip, form.action)

	example use	
	<input name="submit" type="submit" id="submit" value="C o m m i t  T r a n s a c t i o n" onclick="return checkrequired(this.form, 'commit', false, 'process.php') ">
	
*/


function checkrequired(thisform)
{
with (thisform)


if (name.value==""){
	alert("Name is a required field");
	return false
} else {

if (phone.value==""){
	alert("Phone is a required field");
	return false
} 
}
if (checkEmail(email.value)==false)
{email.value="";email.focus();return false}
 


return true
}




function checkEmail (strng) {
	var error="";
	//if (strng == "") {
   		//error = "You didn't enter an email address.";
   		//alert(error);
   		//return false
		//} // end if
	if (!(strng=="")){
	var emailFilter=/^.+@.+\..{2,3}$/;
	if (!(emailFilter.test(strng))) { 
		error = "Please enter a valid email address.";
		alert(error);
		return false
   		}
	else {
	//test email for illegal characters
	var illegalChars= /[\(\)\<\>\,\;\:\\\"\[\]]/
		if (strng.match(illegalChars)) {
			error = "The email address contains illegal characters.";
			alert(error);
			return false
		}
	} //else
	}
	return true   
} // end email


