function ValidateControls()
{
  if (document.forms[0]["txtName"].value=="")
  {
	//document.forms[0]["txtVName"].value="Enter Customer Name";
	alert("Enter Customer Name");
	document.forms[0]["txtName"].focus();
	return false;
  }

  if (document.forms[0]["txtEmail"].value=="")
  {
 	//document.forms[0]["txtVEmail"].value="Enter Email Address";
 	alert("Enter Email Address");
 	document.forms[0]["txtEmail"].focus();
 	return false;
  }
  else
  {
	//var email=document.forms[0]["txtEmail"].value;
	if(emailCheck(document.forms[0]["txtEmail"].value)==false)
	{
		alert("Enter Valid Email Address");
		document.forms[0]["txtEmail"].focus();
	 	return false;
	}
  }

  if (document.forms[0]["txtTelephone"].value=="")
  {
 	//document.forms[0]["txtVPhone"].value="Enter Telephone";
 	alert("Enter Telephone Number");
 	document.forms[0]["txtTelephone"].focus();
 	return false;
  }

  if (document.forms[0]["txtTopic"].value=="")
  {
 	//document.forms[0]["txtVTopic"].value="Enter Topic Name";
 	alert("Enter Topic Name");
 	document.forms[0]["txtTopic"].focus();
 	return false;
  }
  
  if (document.forms[0]["txtTopicDetail"].value=="")
  {
 	//document.forms[0]["txtVTopicDetail"].value="Enter Topic Detail";
 	alert("Enter Topic Detail");
 	document.forms[0]["txtTopicDetail"].focus();
 	return false;
  }
  
	var Length = document.forms[0]["ddlLength"].value;
	var Level = document.forms[0]["ddlLevelType"].value;  
	switch (Level)
	{
		case '26':
					break;
		case '27':
					break;
		case '28':
					break;
		default:
					if (Length == '79')
					{
						alert("Please Select The Word Length");
						return false;
					}
	}
}

function emailCheck(str) {
	
	 var at="@"
	 var dot="."
	 var lat=str.indexOf(at)
	 var lstr=str.length
	 var ldot=str.indexOf(dot)
	
	 // Check If the @ sign is present in Email, invalid if not present ...
	 if (str.indexOf(at)==-1){
	   return false
	 }

	// Check If the @ sign is first or last character of Email, invalid if it is first or last ...
	 if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr-1){
	    return false
	 }
 
	 // Check If the Dot '.' is present in the Email and is first or last character
	 // invalid if not present and Invalid if first or last character ...
	 if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot,lstr-1)==lstr-1){
	     return false
	 }

	 // Check If the @ sign is used more than once in Email ...
	 // Invalid if used more than once .
	  if (str.indexOf(at,(lat+1))!=-1){
	      return false
	  }
 
	 // Check If the '.' appears just before or after '@' sign, than that is Invalid ...
	  if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
	      return false
	  }

	 // Check If the '.' exists after '@' sign (with 1 char gap), Invalid if it does not ...
	  if (str.indexOf(dot,(lat+2))==-1){
	     return false
	  }
  
	  // Check If there is any space in the Email, than that is Invalid ....
	  if (str.indexOf(" ")!=-1){
	     return false
	  }
   
   return true     
}

function ValidateEmailForm()
{
  if (document.forms[0]["txtcustName"].value=="")
  {
	//document.forms[0]["txtVName"].value="Enter Customer Name";
	alert("Enter Customer Name");
	document.forms[0]["txtcustName"].focus();
	return false;
  }

  if (document.forms[0]["txtcustEmail"].value=="")
  {
 	//document.forms[0]["txtVEmail"].value="Enter Email Address";
 	alert("Enter Email Address");
 	document.forms[0]["txtcustEmail"].focus();
 	return false;
  }
  else
  {
	//var email=document.forms[0]["txtEmail"].value;
	if(emailCheck(document.forms[0]["txtcustEmail"].value)==false)
	{
		alert("Enter Valid Email Address");
		document.forms[0]["txtcustEmail"].focus();
	 	return false;
	}
  }

  if (document.forms[0]["txtphone1"].value=="")
  {
 	//document.forms[0]["txtVPhone"].value="Enter Telephone";
 	alert("Enter Telephone Number");
 	document.forms[0]["txtphone1"].focus();
 	return false;
  }

  if (document.forms[0]["txtQuestion"].value=="")
  {
 	//document.forms[0]["txtVTopic"].value="Enter Topic Name";
 	alert("Enter Your comments");
 	document.forms[0]["txtQuestion"].focus();
 	return false;
  }
    
}

function ClearEmailForm()
{
	document.forms[0]["txtcustName"].value="";
	document.forms[0]["txtcustEmail"].value="";
	document.forms[0]["txtphone1"].value="";
	document.forms[0]["txtQuestion"].value="";
	document.forms[0]["txtext1"].value="";
}

function ValidateRequestForm()
{
  if (document.forms[0]["txtFirstName"].value=="")
  {
	alert("Enter First Name");
	document.forms[0]["txtFirstName"].focus();
	return false;
  }

  if (document.forms[0]["txtLastName"].value=="")
  {
	alert("Enter Last Name");
	document.forms[0]["txtLastName"].focus();
	return false;
  }

  if (document.forms[0]["txtEmailAddress"].value=="")
  {
 	alert("Enter Email Address");
 	document.forms[0]["txtEmailAddress"].focus();
 	return false;
  }
  else
  {
	if(emailCheck(document.forms[0]["txtEmailAddress"].value)==false)
	{
		alert("Enter Valid Email Address");
		document.forms[0]["txtEmailAddress"].focus();
	 	return false;
	}
  }

  if (document.forms[0]["txtTelephone"].value=="")
  {
 	alert("Enter Telephone Number");
 	document.forms[0]["txtTelephone"].focus();
 	return false;
  }

  if (document.forms[0]["txtQuestion"].value=="")
  {
 	alert("Enter Your Question");
 	document.forms[0]["txtQuestion"].focus();
 	return false;
  }
    
} 
 
 
 
 
 
 





 
 
 
 
 
 
 