var qaf = document.getElementById('qaform');

function qaValidation(qaf)
	{
		ok=true;
		if(document.getElementById('nameq').value=="")
	{
		alert("Please Enter Your Name.")
		document.getElementById('nameq').focus()
		ok=false;
	}	
	else if(document.getElementById('emailq').value=="")
	{
		alert("Please Mention Your Email ID.");
		document.getElementById('emailq').focus();
		ok=false;
	}
	else if(!isEmailAddr(document.getElementById('emailq').value))
	{
		alert("Please enter a complete email address in the form: yourname@yourdomain.com");
		document.getElementById('emailq').focus();
		ok=false;
	}
	else if(document.getElementById('subjectq').value=="")
	{
		alert("What is the subject of your question.");
		document.getElementById('subjectq').focus();
		ok=false;
	}
	else if(document.getElementById('questionq').value=="")
	{
		alert("Please type your question.");
		document.getElementById('questionq').focus();
		ok=false;
	}
	else if(document.getElementById('phoneq').value=="" || isNaN(document.getElementById('phoneq').value) || document.getElementById('phoneq').value.length<=9 || document.getElementById('phoneq').value.length>10)
	{
		alert("Please enter your valid Phone Number.")
		document.getElementById('phoneq').focus()
		ok=false;
	}
	else if(document.getElementById('stateq').value=="")
	{
		alert("Please enter your state/city.")
		document.getElementById('stateq').focus()
		ok=false;
	}
	else if(document.getElementById('referenceq').value=="")
	{
		alert("How did you know about us.")
		document.getElementById('referenceq').focus()
		ok=false;
	}
	else if(document.getElementById('messageq').value=="")
	{
		alert("Please, explain in detail about your qualification, professional background, and date of joining etc.")
		document.getElementById('messageq').focus()
		ok=false;
	}
	else if(document.getElementById('captcha-q').value=="" || document.getElementById('captcha-q').value<4 || document.getElementById('captcha-q').value>4 ||isNaN(document.getElementById('captcha-q').value))
	{
		alert("Plz enter total of 2+2, to know that you are a human?")
		document.getElementById('captcha-q').focus()
		ok=false;
	}
	return ok;
}
function isEmailAddr(email)
{
  var result = false;
  var theStr = new String(email);
  var index = theStr.indexOf("@");
  if (index > 0)
  {
	var pindex = theStr.indexOf(".",index);
	if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}
