

function validateForm(){
	var fname, lname, email;
	
	fname = removeSpaces(document.fitForm.fname.value);
	lname = removeSpaces(document.fitForm.lname.value);
	email = removeSpaces(document.fitForm.email.value);


		if (fname == "") 
		{
			alert ("Please Enter First Name.");
			document.fitForm.fname.select();
			document.fitForm.fname.focus();
			return false;
		}
		if (lname == "") 
		{
			alert ("Please Enter Last Name.");
			document.fitForm.lname.select();
			document.fitForm.lname.focus();
			return false;
		}
		if (email == "") 
		{
			alert ("Please Enter Email Address.");
			document.fitForm.email.select();
			document.fitForm.email.focus();
			return false;
		}else{
			if (!emailValidation(email))
			{
				alert ("Please Enter a Valid Email Address.");
				document.fitForm.email.select();
				document.fitForm.email.focus();
				return false;
			}
		}
		
		
}// end of validateOrderForm

function emailValidation(vareamil){
	var scan=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	if (scan.test(vareamil)){
		return true
	}
	return false
}// end of emailValidation

function emailValidation_v1(vareamil){
	var s = new String(vareamil);
	if (s.length < 7) { return false; }
	if (s.indexOf("@") <1 ) { return false; } // checking @ and at least one character before @
	if (s.indexOf(".") < 4 ) { return false; } // checking positon of .
	if ((s.indexOf(".") - s.indexOf("@")) < 3){ return false; }
	return true;
}// end of emailValidation

function removeSpaces(str) {
	var s = new String(str);
	for(i = 0; i < s.length; i++)
	{
		if (s.charAt(i) != " ")
		{
			return s;
		}
	}
	return "";
}


