



function echeck(str) {

		var at="@"

		var dot="."

		var lat=str.indexOf(at)

		var lstr=str.length

		var ldot=str.indexOf(dot)

		if (str.indexOf(at)==-1){

		   alert("Invalid E-mail ID")

		   return false

		}



		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){

		   alert("Invalid E-mail ID")

		   return false

		}



		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr-1){

		    alert("Invalid E-mail ID")

		    return false

		}

		 if (str.indexOf(at,(lat+1))!=-1){

		    alert("Invalid E-mail ID")

		    return false

		 }



		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){

		    alert("Invalid E-mail ID")

		    return false

		 }



		 if (str.indexOf(dot,(lat+2))==-1){

		    alert("Invalid E-mail ID")

		    return false

		 }



		 if (str.indexOf(" ")!=-1){

		    alert("Invalid E-mail ID")

		    return false

		 }



 		 return true

	}


function  ename(str)

{
	 if((str.substring(0,1)<"a" || str.substring(0,1)>"z") && (str.substring(0,1)<"A" || str.substring(0,1)>"Z"))

	{

		alert("The Name should be alphabetic characters and not numeric.");

		return false;

	 }

   return true

}

function isPhno(str)

{

    var str = document.form.phno.value;

         if((str.substring(0,1)<"a" || str.substring(0,1)>"z") && (str.substring(0,1)<"A" || str.substring(0,1)>"Z"))

	 		{

			}

		else
			{
			   alert("The Phone Number should be numaric and not an alphabetic & special characters.");
				return false;
		    }
	for (var i = 1; i < str.length; i++)
	{

		var ch = str.substring(i, i + 1);
		if ( ((ch < "a" || "z" < ch) && (ch < "A" || "Z" < ch)) && (ch < "0" || "9" < ch) && (ch != '_') && (ch != '.'))
		{
			alert("\nThe phone number field accepts numbers\n\nPlease enter your phone number.");
			document.form.phno.select();
			document.form.phno.focus();
			return false;
		}

   }
   return true

}


function Validator()

{


	if(form.cname.value == "")

	{

		alert("Please Enter Your Name");

		form.cname.focus();
	
		return false ;

	}

 if (ename(form.cname.value)==false)

	{
        form.cname.focus();
         return false;
	}
	if(form.cname.value.length < 3)
	{
	 alert("Please Enter a Proper Name")
		   form.cname.focus();
		   return false;
	}
		   
    if(form.comname.value== "")

	{

       alert("Please Enter Your Company Name");

	   form.comname.focus();

        return false ;

	}

  if(form.addr.value== "")

	{

       alert("Please Enter Your Address");

	   form.addr.focus();

        return false ;

	}

if(form.qry1.value== "")

	{
       alert("Please Select The Country");

	   form.qry1.focus();

        return false ;

	}


 if(form.phno.value== "")

	{

       alert("Please Enter Your Phone Number");

	   form.phno.focus();

        return false ;

	}


  if(isPhno(form.cname.value)==false )

	{

      form.phno.focus();

	  return false ;

	}


 if (form.email.value == "")

	{

		alert("Please Enter Your Email Address");

		form.email.focus();

		return false ;

	}


	if (echeck(form.email.value)==false){

		//email.value="";

		form.email.focus();

		return false ;

	}

	if (form.msg.value == "")

		{

			alert("Please Enter the Message.");

			form.msg.focus();

			return false ;

		}

     if (form.vercode.value == "")

		{

			alert("Please Enter The Number.");

			form.vercode.focus();

			return false ;

		}

return true;

}
