function ValidateForm()
{
 
// NAME
	   var l=document.applynow.name.value.length;
	var m=document.applynow.name.value;
	var p=document.applynow.name;
	for(var i=0; i<l-1; i++)
		{
		n=m.substring(i, i+2);
		if(n=="  " || n==".." || n=="''")
			{
			alert("Invalid name, Please re-enter")
				p.focus();
			p.select();
			return false;
			}
		}
	if(m=='') {
		alert("Please enter your  Name");
		p.focus();
		p.select();
		return false;
	}       
	
	for (var i=0; i<l; i++)
		{
		var q=m.substring(i, i + 1);
		if (((q < "a" || "z" < q) && (q < "A" || "Z" < q)) && q != ' ' && q!='.' && q!="'") {
			alert("\n The Name field only accepts letters & spaces.\n\nPlease re-enter your Name.");
			
			p.select();
			p.focus();
			return false;
		}
	}  

// phone no

 /* var m1=document.applynow.phone.value;
	var p1=document.applynow.phone;
	
	var objRegExp  = /^((\(\d{3}\))|(\d{3}))\s?(\.|\-|\s)?\d{3}(\.|\-|\s)\d{4}$/;

	
	if(m1=='') {
		alert("Enter your Phone Number");
		p1.select();
		p1.focus();

		return false;
	} 
	if(!objRegExp.test(m1)) {
		alert('Please Enter Valid Phone Number');
		p1.select();
		p1.focus();
		return false;
   	} */
	
	//  phone number
  
	var m1=document.applynow.phone.value;
	var m4=document.applynow.phone.value.length;
	var p1=document.applynow.phone;
	
	
	if(m1=='') {
		alert("Please Enter Your TelePhone No");
		p1.select();
		p1.focus();
		return false;
	}
	 
	
	if((m1!='') && isNaN(m1.substr(0,5)))
	{
		alert("Please Enter Numbers only");
		p1.select();
		 p1.focus();
		return false;
	}
 

//EMAIL
   var m=document.applynow.email;
	var n=document.applynow.email.value;
	if ((n==null)||(n=="")){
		alert("Please enter your Email ID")
		m.select();
		 m.focus();
		return false
	}
	if (echeck(n)==false){
		alert('Please enter valid email ID');
		m.select();
		 m.focus();
		return false;
	}
	function echeck(str) {
	at = str.indexOf("@");
	dot = str.lastIndexOf(".");
	lengt = str.length;
	con1 = str.substring(0,at);
	con2 = str.substring(at+1,dot);
	con3 = str.substring(dot+1,lengt);

	if(con1=='' || con2=='' || con3=='') return false;

	if(str.indexOf("  ") > -1 || str.indexOf("..") > -1 || str.indexOf("__") > -1 || str.indexOf("--") > -1) return false;
	
	if(at==-1 || dot==-1) return false;

	x = con1.substring(0,1);
	if ((x < "a" || "z" < x) && (x < "A" || "Z" < x) && isNaN(x)) return false;

	x = con1.substring((con1.length)-1,(con1.length));
	if ((x < "a" || "z" < x) && (x < "A" || "Z" < x) && isNaN(x)) return false;

	x = con1.substring(1,(con1.length)-1);
	for(i=0, y=0; i<con1.length-2; i++, y=x.substring(i, i+1)) if ((y < "a" || "z" < y) && (y < "A" || "Z" < y) && isNaN(y) && y!='.' && y!='_' && y!='-') return false;
	
	x = con2.substring(0,1);
	if ((x < "a" || "z" < x) && (x < "A" || "Z" < x) && isNaN(x)) return false;

	x = con2.substring((con2.length)-1,(con2.length));
	if ((x < "a" || "z" < x) && (x < "A" || "Z" < x) && isNaN(x)) return false;
	
	x = con2.substring(1,(con2.length)-1);
	for(i=0, y=0; i<con2.length-2; i++, y=x.substring(i, i+1)) if ((y < "a" || "z" < y) && (y < "A" || "Z" < y) && isNaN(y) && y!='.' && y!='_' && y!='-') return false;		
	
	for(i=0, x=0; i<con3.length; i++, x = con3.substring(i, i+1)) if ((x < "a" || "z" < x) && (x < "A" || "Z" < x)) return false;
	if ((con3.length)<2 || (con3.length)>4)  return false;
} 
 //city
 var m=document.applynow.comments.value;
 var p=document.applynow.comments;
 if(m==''){
 alert("Please enter the Comments");
 p.focus();
  p.select();
 return false;
 } 
 } 
 