function loginfrm(theform)
{
  if (theform.memid.value=="")
  {
    alert("Please enter MembershipId");
    theform.memid.focus();
    return false;
  }
  if (theform.pass.value=="")
  {
    alert("Please enter Password");
    theform.pass.focus();
    return false;
  }
  return true;
}

function validateform(theform)
{

if(theform.name.value=="" || theform.name.value==" ")
{
	alert("Please enter your name.");
	theform.name.select();
	theform.name.focus();
	return false;
}
else
{
	for(var i=0;i<theform.name.value.length;i++)
	{
		 if(theform.name.value.charAt(i)<'A' ||  theform.name.value.charAt(i)>'Z')
		{
			 if(theform.name.value.charAt(i)<'a' ||  theform.name.value.charAt(i)>'z')
			{
				 if(!((theform.name.value.charAt(i)=='.') || (theform.name.value.charAt(i)==' ')))
				 {
					  alert("Only alphabets, a space and a . are allowed in the name field.");
					  theform.name.select();
					  theform.name.focus();
					  return false;
				 }
			}
		}
	}
}

if(theform.address.value=="")
{
 alert("Please enter your address.");
 theform.address.select();
 theform.address.focus();
 return false;
}

if(theform.phone.value == "" && theform.email.value=="")
{
 alert("Either the phone number or the email-id is compulsory.");
 theform.phone.select();
 theform.phone.focus();
 return false;
}

if (theform.phone.value!="")
{
 a = theform.phone.value;
 var i=0;
 for(i=0;i<a.length;i++)
 {
  if(a.charAt(i) < '0' || a.charAt(i) > '9') 
  {
  if(!(a.charAt(i) == ' ' || a.charAt(i) == '(' || a.charAt(i)==')' || a.charAt(i)==',' || a.charAt(i)=='/' || a.charAt(i)=='-' || a.charAt(i)=='+' || a.charAt(i)=='[' || a.charAt(i)==']')) 
    {
     alert("Characters and Special symbols are not allowed in the Phone field.");
     theform.phone.select();
     theform.phone.focus();
     return false;
  }
   }
 }
}

if (theform.email.value!="")
{
 if (theform.email.value.indexOf(".")==-1 || theform.email.value.indexOf("@")==-1)
  {
  alert("Please enter a valid email address.");
  theform.email.focus();
  theform.email.select();
  return false;
  }
}

if (theform.comments.value=="")
{
alert("Please enter your comments/suggestions.");
theform.comments.select();
theform.comments.focus();
return false;
}
return true;
}

function forgotpass(theform)
{
 if(theform.memid.value=="")
 {
  alert("Please enter MembershipID.");
  theform.memid.select();
  theform.memid.focus();
  return false;
 }

/*if(theform.email.value=="")
{
alert("Please enter your mailid.")
theform.email.select();
theform.email.focus();
return false;
}

if((theform.email.value.indexOf(".") == -1 || theform.email.value.indexOf("@") == -1) &&  theform.email.value != "")
{
alert("Please enter a valid email address.");
 theform.email.focus();
 theform.email.select(); 
  return false;
}*/
 return true;
}


function changepassenter(theform)
{
 if(theform.oldpass.value=="")
 {
  alert("Please enter the old password.");
  theform.oldpass.select();
  theform.oldpass.focus();
  return false;
 }
 else
 {
  a = theform.oldpass.value;
  for(i=0;i<a.length;i++)
  {
   if(a.charAt(i)==" ")
   {
    alert("Please do not leave blank space in the old password field.");
    theform.oldpass.select();
    theform.oldpass.focus();
    return false;
   }
   }
  }
 if(theform.newpass.value=="")
 {
  alert("Please enter the new password.");
  theform.newpass.select();
  theform.newpass.focus();
  return false;
 }
 else
 {
  a = theform.newpass.value;
  for(i=0;i<a.length;i++)
  {
   if(a.charAt(i)==" ")
   {
    alert("Please do not leave blank space in the new password field.");
    theform.newpass.select();
    theform.newpass.focus();
    return false;
   }
   }
  }
 if(theform.conpass.value=="")
 {
  alert("Please enter the new password to confirm.");
  theform.conpass.select();
  theform.conpass.focus();
  return false;
 }

 if(theform.conpass.value!=theform.newpass.value)
 {
  alert("The new password and confirm password should be identical.");
  theform.conpass.select();
  theform.conpass.focus();
  return false;
 }
 
 return true;
}

function changepass(theform)
{
if(theform.UserId.value=="")
{
 alert("Please enter a valid email Id.");
 theform.UserId.select();
 theform.UserId.focus();
 return false;
}

if(theform.password.value=="")
{
 alert("Please enter a valid password.");
 theform.password.select();
 theform.password.focus();
 return false;
}

return true;
}