function ContactUsValidation()

{

	//alert("test");

	
	var name = $("#txtName").val();

	var email = $("#txtEmail").val();

	var phone = $("#txtPhone").val();

	var place = $("#txtPlace").val();

	var course = $("#txtCourse").val();

	var comments = $("#txtComments").val();

	

	if(name==""){

		alert("Please Enter Name");

		$("#txtName").focus();

		return false;

	}

	if(email==""){

		alert("Please Enter email id.");

		$("#txtEmail").focus();

		return false;

	}  	

	var checkEmail = "@.";

	var checkStr = email;

	var EmailValid = false;

	var EmailAt = false;

	var EmailPeriod = false;

	for (i = 0;  i < checkStr.length;  i++)

	{

		ch = checkStr.charAt(i);

		for (j = 0;  j < checkEmail.length;  j++)

		{

			if (ch == checkEmail.charAt(j) && ch == "@")

			EmailAt = true;

			if (ch == checkEmail.charAt(j) && ch == ".")

			EmailPeriod = true;

			if (EmailAt && EmailPeriod)

			break;

			if (j == checkEmail.length)

			break;

		}

		

		if (EmailAt && EmailPeriod)

		{

			EmailValid = true;

			break;

		}

	}

	if (!EmailValid)

	{

		alert("The \"email\" field must contain an \"@\" and \".\".");

		$("#txtEmail").focus();

		$("#txtEmail").val('');

		return false;

	}	

	

	if(phone=="")

	{

		alert("You must enter the Phone Number");

		$("#txtPhone").focus();

		return false;

	}

	var checkOK = "0123456789";

	var checkStr = phone;

	var allValid = true;

	var allNum = "";

	

	for (i = 0;  i < checkStr.length;  i++)

	{

	   ch = checkStr.charAt(i);

		  for (j = 0;  j < checkOK.length;  j++)

		   if (ch == checkOK.charAt(j))

			 break;

			if (j == checkOK.length)

			{

				  allValid = false;

				  break;	

			}

			if (ch != ",")

			allNum += ch;

	}			   

	if (!allValid)

	{

		 alert("Please enter only digits in the \"Phone Number\" field.");

		 $("#txtPhone").focus();

		 $("#txtPhone").val('');

		 return false;

	}

	

	if(place=="")

	{

		alert("Please enter your Place");

		$("#txtPlace").focus();	

		return false;

	}	

	

	if(course=="")

	{

		alert("Please enter your Course");

		$("#txtCourse").focus();	

		return false;

	}	

	if(comments==""){

		alert("Give your Feedback");

		$("#txtFeedback").focus();

		return false;

	}

	
	else

	{

		 $.post("feedback.php", {name: name, email: email, phone: phone,  address: address, comments: comments},

		  function(data){

			//alert("Data Loaded: " + data);			

			if(data==1)

			{

				alert("Your information is successfully sent to webtotal.in, we will get back to you soon.");
				alert("success");
				document.location.href="thankyou.html";

			}else{

				alert("Your mail has been failed. Please try again.");

			}

			alert(data);

			$("#SendMailDiv").html(data);	


			$("#txtName").val('');

			$("#txtEmail").val('');

			$("#txtPhone").val('');

			$("#txtAddress").val('');	

			$("#txtComments").val('');
			if(data==0)

			{

				alert("Data Loaded: " + data);

				alert("Sorry but the email could not be sent. Please try again!");

			}else{

				$(name).html(data);

				alert("Data Loaded: " + data);				

			}

		  });

		return false;

	}

	return true;

}
