function chksalutation()
{
	sal=new String()
	sal=document.form1.salutation.value
	if (sal.length == 0)
	{
	alert("Salutation field cannot be empty");
	}
	else
	{
		chkname()
	}
	
}
function chkname()
{
 var ch=0;
 name=new String();
 name=document.form1.firstname.value;
 
 if (name.length==0)
  alert ("Enter your First Name")
 else
 {
  u=0;
  for (i=0;i<name.length;i++)
  {
   if ((name.charCodeAt(i) >= 64 && name.charCodeAt(i) <= 90)||(name.charCodeAt(i) >= 97 && name.charCodeAt(i) <= 122)||(name.charCodeAt(i)==46)||(name.charCodeAt(i)==32))
   {
   }
   else
   {
    u=u+1;
   }
  }
  if (u>0)
  {
   alert ("Invalid First Name");
  }
  else
  {
   chklname()
  }
 } 
}
function chklname()
{
 var ch=0;
 lname=new String();
 lname=document.form1.lastname.value;
 
 if (lname.length==0)
  alert ("Enter your Last name")
 else
 {
  u=0;
  for (i=0;i<lname.length;i++)
  {
   if ((lname.charCodeAt(i) >= 64 && lname.charCodeAt(i) <= 90)||(lname.charCodeAt(i) >= 97 && lname.charCodeAt(i) <= 122)||(lname.charCodeAt(i)==46)||(lname.charCodeAt(i)==32))
   {
   }
   else
   {
    u=u+1;
   }
  }
  if (u>0)
  {
   alert ("Invalid Last name");
  }
  else
  {
   chktitle()
  }
 } 
}
function chktitle()
{
 var ch=0;
 ttl=new String();
 ttl=document.form1.titledrop.value;
 
 if (ttl.length==0)
  alert ("Enter a Title")
 else
 {
  u=0;
  for (i=0;i<ttl.length;i++)
  {
   if ((ttl.charCodeAt(i) >= 64 && ttl.charCodeAt(i) <= 90)||(ttl.charCodeAt(i) >= 97 && ttl.charCodeAt(i) <= 122)||(ttl.charCodeAt(i)==46)||(ttl.charCodeAt(i)==32))
   {
   }
   else
   {
    u=u+1;
   }
  }
  if (u>0)
  {
   alert ("Invalid Title");
  }
  else
  {
   chkorg()
  }
 } 
}
function chkorg()
{
 var ch=0;
 org=new String();
 org=document.form1.organization.value;
 
 if (org.length==0)
  alert ("Enter a organization")
 else
 {
  u=0;
  for (i=0;i<org.length;i++)
  {
   if ((org.charCodeAt(i) >= 64 && org.charCodeAt(i) <= 90)||(org.charCodeAt(i) >= 97 && org.charCodeAt(i) <= 122)||(org.charCodeAt(i)==46)||(org.charCodeAt(i)==32))
   {
   }
   else
   {
    u=u+1;
   }
  }
  if (u>0)
  {
   alert ("Invalid organization");
  }
  else
  {
   chkemail()
  }
 } 
}
function chkemail()
{
 mail=new String();
 mail=document.form1.emaildrop.value
 
 if (mail.length==0)
   alert("Please enter e-mail address.");
 else
  {
   at_pos=mail.indexOf("@")
   dot_pos=mail.indexOf(".")
   if(at_pos<1 || dot_pos<1)
   alert("Missing '@' and '.' in email address.")
   
 else
  {
   u=0;
   p=0;
   for(var i=0;i<mail.length;i++)
   {
    if ((mail.charCodeAt(i) >= 64 && mail.charCodeAt(i) <= 90)||(mail.charCodeAt(i) >= 97 && mail.charCodeAt(i) <= 122)||(mail.charCodeAt(i) >= 48 && mail.charCodeAt(i) <= 57)||(mail.charCodeAt(i)==95)||(mail.charCodeAt(i)==46))
	{
	 if(mail.charAt(i)=="@")
	  p=p+1
	}
	else
	{
	 u=u+1
	}
   }
   if (p>1)
    alert ("Email must have only one '@'")
   if (u>0)
	 alert ("Special Characters are not allowed")
	else
	chktelno()
  }
 }	
}
function chktelno()
{
	var numericExpression1 = /^[0-9]+$/;
	phone=new String()
	phone=document.form1.telephonedrop.value
	if (phone.length == 0 )
	{
	alert("Telephone number cannot be empty");
	}
	else
	{
		if((numericExpression1).test(phone))
		{
			//alert("go ahead");
			chkcountry()
		}
		else
		{
			alert("Enter proper Telephone number");
		}
	}
}

function chkcountry()
{
	cnt=new String()
	cnt=document.form1.countrydrop.value
	if (cnt.length == 0)
	{
	alert("Please select a country");
	}
	else
	{
		chkstatus()
	}
	
}
function chkstatus()
{
	status1=new String()
	status1=document.form1.projectstatus1.value
	if (status1.length == 0)
	{
	alert("Please select project status");
	}
	else
	{
		chkrole()
	}
	
}
function chkrole()
{
	role=new String()
	role=document.form1.roledrop.value
	if (role.length == 0)
	{
	alert("Please select role you played");
	}
	else
	{
		chkemployee()
	}
	
}
function chkemployee()
{
	emp=new String()
	emp=document.form1.employeesdrop.value
	if (emp.length == 0)
	{
	alert("Please select number of employees in a company");
	}
	else
	{
		chkannual()
	}
	
}
function chkannual()
{
	an=new String()
	an=document.form1.annualsalesdrop.value
	if (an.length == 0)
	{
	alert("Please select annual Sales of a company");
	}
	else
	{
		buttonClick()
	}
}
