/*Form Validation*/
		function checkLength(text, min, max) //Checks to see if the field is blank
		{
		 	min = min || 1;
 			max = max || 10000;

		 if (text.length < min || text.length > max) {
 		 return false;
 			}
		 return true;
		}
		

		function validateForm(form)
		{
				var emailcheck = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/; // Variable for email format

				var fname = form.fname.value
				var lname = form.lname.value
				var email = form.email.value;
				var message = form.message.value;
				
				//Validates Name Field
				if(!checkLength(fname)){
				alert("Please Enter Your First Name");
				return false;
				}
				
				if(!checkLength(lname)){
				alert("Please Enter Your Last Name");
				return false;
				}

			// Validates email length 
			if(!checkLength(email)){
				/*document.getElementById("buyer").style.borderColor="red" ; 
				document.getElementById("buyer").style.borderWidth="1px" ;
				document.getElementById("buyer").style.backgroundColor="pink";
				document.getElementById("buyer").style.backgroundImage="none";
				document.getElementById("email_error").style.display="block";*/
				alert("Please enter a valid email!");
				return false;		
						}

			
			if(!emailcheck.test(email))
 			{	
			alert("Invalid email");
 			return false;
 		
 			}
			
			
		

			// Validates message
			if(message.length === 0){
				alert("Please enter a message!");
				/*document.getElementById("message").style.borderColor="red" ;
				document.getElementById("message").style.backgroundColor="pink";
				document.getElementById("message").style.backgroundImage="none";
				document.getElementById("message_error").style.display="block";*/
				return false;
					}

		return true;

		}







