// JavaScript Document
function frmValidate(theForm) {
	var reason = "";
	
  reason += validatename(theForm.name);
  reason += validateemail(theForm.email);
  reason += validateinterest(theForm.interest);
  reason += validatedescription(theForm.description);
  if (reason != "") {
    alert("Please fill the below Items:\n\n" + reason);
    return false;
  }
   window.location='quickquoteform.php';
  return false;

}
function validatename(fld) {
    var error = "";
 
    var illegalChars = /\W/; // allow letters, numbers, and underscores
 
    if (fld.value == "") 
	{
        //fld.style.background = 'Yellow'; 
        error = "Please Enter Name .\n";
    }
	else
	 {
        fld.style.background = 'White';
     }
    return error;
}
function validateemail(fld) 
{	
	var error = "";
	var x=document.forms["form"]["email"].value
	var atpos=x.indexOf("@");
	var dotpos=x.lastIndexOf(".");
	if (atpos < 1 || dotpos<atpos+2 || dotpos+2>=x.length)
	  {
	  error="Not a valid e-mail address.\n";
	  }
	 return error;
}

function validateinterest(fld)
 {
    var error = "";
    var illegalChars = /\W/; // allow letters, numbers, and underscores
 
    if (fld.value == "") 
	{
       // fld.style.background = 'Yellow'; 
        error = "Please Choose Primary Interest.\n";
    }
	else 
	{
        fld.style.background = 'White';
    }
    return error;
}
function validatedescription(fld) {
   	
	var error = "";
	
	 if (fld.value == "") {
	 	//fld.style.background = 'White';
		 error = "Please Enter Project Description.\n";
		
     } else {
        fld.style.background = 'White';
    }
    return error;
}
