function validate(form){
		if(document.registration.lastname.value==""){
			alert("Please fill in required field 'Last name'.");
			document.medcom.lastname.focus();
			return false;
		}
		if(document.registration.firstname.value==""){
			alert("Please fill in required field 'First name'.");
			document.medcom.firstname.focus();
			return false;
		}
		if(document.registration.firstname.value==document.registration.lastname.value){
			alert("First Name should not be same as Last Name");
			document.medcom.firstname.focus();
			return false;
		}
		if(document.registration.middlename.value==""){
			alert("Please fill in required field 'Middle name'.");
			document.medcom.middlename.focus();
			return false;
		}
		if(document.registration.phone_area_code.value==""){
			alert("Please fill in required field 'Area code'.");
			document.medcom.phone_area_code.focus();
			return false;
		}
		if(document.registration.phone.value==""){
			alert("Please fill in required field 'Phone number'.");
			document.medcom.phone.focus();
			return false;
		}
		if(document.registration.doctor_name.value==""){
			alert("Please fill in required field 'Doctor name'.");
			document.medcom.doctor_name.focus();
			return false;
		}
		if(document.registration.practice_type.value==""){
			alert("Please fill in required field 'Practice Type'.");
			document.medcom.practice_type.focus();
			return false;
		}
		if(document.registration.practice_type.value==""){
			alert("Please fill in required field 'Practice Type'.");
			document.medcom.practice_type.focus();
			return false;
		}
		if(document.medcom.mailfrom.value == "")
	{
	    alert("Please Enter your Email Address");
		document.medcom.mailfrom.focus();
		return false;
	}
	
	if(document.registration.city_name.value==''){
			alert("Please fill in required field 'First name'.");
			document.registration.city_name.focus();
			return false;
		}
		var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
            var checkStr = document.registration.city_name.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 letters in the \"First Name \" field."); 
            document.registration.city_name.focus();
            return (false);
            }
	
	
	var count1=0;
	var flag1=true,flag2=true;
	var email2=document.medcom.mailfrom.value;	var len_email=email2.length;
	for(var i=0;i<len_email;++i)
	{
		  var char1=email2.charAt(i);
		  if(char1=="@")
		  {	
			  if(email2.charAt(i+1)==".")flag2=false; 
			  count1++;
			  for(var j=i;j<len_email;++j)
			  {
			    	var char2=email2.charAt(j);
			    	if(char2==".")flag1=false; 
			  }
		   }
	}	
	if(flag2==false||flag1==true||count1>1||email2.charAt(0)=="@"||email2.charAt(len_email-1)==".")
	{   alert("invalid email address");document.medcom.mailfrom.focus();document.medcom.mailfrom.select();  return false;}
	if(email2.indexOf(" ")>=0)
	{
	 alert("Email address does not allow spaces");document.medcom.email.focus();document.medcom.mailfrom.select();
	 return false;
	}
		return true;
}

