  function validate()
  {
	var contactus=document.forms[0];
	 if(contactus.yname.value =="")
	{
	  alert("PLEASE ENTER YOUR NAME");
	  contactus.yname.select();
	  return false;
	   
	}
	if(contactus.no.value =="")
	{
	   alert("PLEASE ENTER YOUR CONTACT NUMBER");
	   contactus.no.select();
	   return false;
	}
	if(contactus.email.value =="")
	{
	  alert("PLEASE ENTER YOUR EMAIL ID");
	  contactus.email.select();
	  return false;
	}
	if(contactus.city.value =="")
	{
	  alert("PLEASE ENTER YOUR CITY ");
	  contactus.city.select();
	  return false;
	}
	

   	
	var checkEmail = "@.";
	var checkStr = contactus.email.value;
	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 both the @ and . were in the string
		if (EmailAt && EmailPeriod)
		{
			EmailValid = true
			break;
		}
	}
	if (!EmailValid)
	{
		alert("Invalid Email ID");
		contactus.email.select();
		return false;
	}					
	//CHECKING NOPS IS NUMBER ONLY- PHONE1			
	var checkOK = "0123456789:";
	var checkStr = contactus.no.value;
	var allValid = true;
	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 (!allValid)
	{
		alert("Please enter only numeric characters Phone no. field.");
		contactus.no.select();
		return false;
	}
	//CHECKING NOPS IS NUMBER ONLY- PHONE 2				
	var checkOK = "0123456789:";
	var checkStr = contactus.sno.value;
	var allValid = true;
	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 (!allValid)
	{
		alert("Please enter only numeric characters contect no2. field.");
		contactus.sno.select();
		return false;
	}	
	//CHECKING NOPS IS NUMBER ONLY	- MOBILE			
	var checkOK = "0123456789:";
	var checkStr = contactus.mno.value;
	var allValid = true;
	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 (!allValid)
	{
		alert("Please enter only numeric characters Mobile no. field.");
		contactus.mno.select();
		return false;	
	}	
	
	return true;
  }
