function onlinevalidate(onlineAppointmentfrm)
 {
   if (onlineAppointmentfrm.user.value=="")
   {
    alert("Please Enter  Name.");
    onlineAppointmentfrm.user.focus();
    onlineAppointmentfrm.user.select();
    return false;  
   } 
    if (((onlineAppointmentfrm.user.value.charAt(0) < "a") || (onlineAppointmentfrm.user.value.charAt(0) > "z")) && ((onlineAppointmentfrm.user.value.charAt(0) < "A") || (onlineAppointmentfrm.user.value.charAt(0) > "Z")))
	{
	 alert("Your Name should start with a character. !!!");
   	onlineAppointmentfrm.user.focus();
   	onlineAppointmentfrm.user.select(); 
	return false;
	}
		
for (i=1; i<onlineAppointmentfrm.user.value.length; i++) {
	var d = onlineAppointmentfrm.user.value.charAt(i)
	
	switch (d)
	{
	case "?":
alert("Error: Input contains invalid characters!");		return false;
	break
	case "'":
alert("Error: Input contains invalid characters!");		return false;
	break
	case ">":
alert("Error: Input contains invalid characters!");		return false;
	break
	
	case "<":
alert("Error: Input contains invalid characters!");		 return false;
	break
	case "@":
alert("Error: Input contains invalid characters!");		 return false;
	break	
	
	case ";":
alert("Error: Input contains invalid characters!");		 return false;
	break	
	case "-":
alert("Error: Input contains invalid characters!");		 return false;
	break	
	}
	}
	 if ((onlineAppointmentfrm.user.value.length < 3) || (onlineAppointmentfrm.user.value.length > 30))
  {
   alert("Your Name cotain minimum 3 character and maximum 30 character.");
   onlineAppointmentfrm.user.focus();
   onlineAppointmentfrm.user.select(); 
   return false;
  }


  
   var re = /^[\w ]+$/; 
// validation fails if the input doesn't match our regular expression
 if(!re.test(onlineAppointmentfrm.user.value)) { alert("Error: Input contains invalid characters!"); onlineAppointmentfrm.user.focus(); return false; } 
 
     if (onlineAppointmentfrm.email.value=="")
   {
    alert("Enter Your Valid E-mail address");
    onlineAppointmentfrm.email.focus();
    onlineAppointmentfrm.email.select();
    return false;  
    } 

    if (onlineAppointmentfrm.email.value!="")
    {
     if (onlineAppointmentfrm.email.value.indexOf("@")==-1)
      {
        alert("Enter a valid Email Address");
        onlineAppointmentfrm.email.focus();
        onlineAppointmentfrm.email.select();
        return false;
      }
     if (onlineAppointmentfrm.email.value.indexOf(".")==-1)
      {
        alert("Enter a valid Email Address");
        onlineAppointmentfrm.email.focus();
        onlineAppointmentfrm.email.select();
        return false;
      }
      if(onlineAppointmentfrm.email.value.length < 9)
      {
        alert("Enter a valid Email Address");
        onlineAppointmentfrm.email.focus();
        onlineAppointmentfrm.email.select();
        return false;
      }
    }
	
		if (onlineAppointmentfrm.phone.value=="")
   {
    alert("Enter Your Phone number");
    onlineAppointmentfrm.phone.focus();
    onlineAppointmentfrm.phone.select();
    return false;  
    }
	  if(onlineAppointmentfrm.phone.value!="")
  {
     var  str = onlineAppointmentfrm.phone.value
     for (var i = 0; i < str.length; i++)
       {
         if(str.length > 12 || str.length < 12)
           {
            alert("Enter Your Phone number in format specified (123-123-1234)")
            onlineAppointmentfrm.phone.focus();
            onlineAppointmentfrm.phone.select();
            return false;
           }
       }  
    }
 if (onlineAppointmentfrm.custom_Comments.value=="")
   {
    alert("Please Enter comments");
    onlineAppointmentfrm.custom_Comments.focus();
    onlineAppointmentfrm.custom_Comments.select();
    return false;  
   } 

 }
