function validate(theform)
{

	str="~!@#$%^&*()_+-<>?:;[]{}()|.\'\"/\\";
	val=theform.username.value;
	len=val.length;
	if (val=='')
	{
		alert ("You should write your User Name");
		theform.username.focus();
		return false;
	}
	for(i=0;i<len;i++)
	 {
  		ch=val.charAt(i);
		if(str.indexOf(ch)!=-1)
		{
			alert ("You should enter letters or digit only in your User Name");
			theform.username.focus();
			theform.username.select();
			return false;
			break;
		}
	}
	
	str="~!@#$%^&*()_+-<>?:;[]{}()|.\'\"/\\";
	val=theform.pass1.value;
	len=val.length;
	if (val=='')
	{
		alert ("You should write your Password");
		theform.pass1.focus();
		return false;
	}
	for(i=0;i<len;i++)
	 {
  		ch=val.charAt(i);
		if(str.indexOf(ch)!=-1)
		{
			alert ("You shouldn't enter any symbole letters in password");
			theform.pass1.focus();
			theform.pass1.select();
			return false;
			break;
		}
	}
  




	valP=theform.pass1.value;
	valCP=theform.pass2.value;
	len=valCP.length;
	if (len=='')
	{
		alert ("You should Confirm your Password");
		theform.pass2.focus();
		return false;
	}
	if (valP!=valCP)
	{
		alert ("Write the same Password in Confirm Password");
		theform.pass2.focus();
		return false;
	}
	
if (theform.companyname.value == '')
	{
	alert("You should Write Company Name");
	theform.companyname.focus();
	return false;
	}

ind=theform.country.selectedIndex;
	if(theform.country[ind].value=="0")
	{
		alert("Select your Country");
		theform.country.focus();
		return false;
	}
	
    if(theform.country[ind].value=="other")
	{
		val=theform.othercountry.value;
			len=val.length;
			if (val=='')
			{
				alert ("You should write your Other Country");
				theform.othercountry.focus();
				return false;
				
			}
	
	}
ind=theform.city.selectedIndex;
	if(theform.city[ind].value=="0")
	{
		alert("Select your City");
		theform.city.focus();
		return false;
	}
	
    if(theform.city[ind].value=="other")
	{
		val=theform.othercity.value;
			len=val.length;
			if (val=='')
			{
				alert ("You should write your Other City");
				theform.othercity.focus();
				return false;
				
			}
	
	}

if (theform.address.value == '')
	{
	alert("You should Write Your Address");
	theform.address.focus();
	return false;
	}
	
if (theform.postalcode.value == '')
	{
	alert("You should Write Your postal code");
	theform.postalcode.focus();
	return false;
	}
if (theform.cp1.value == '')
	{
	alert("You should Write Your Company Phone");
	theform.cp1.focus();
	return false;
	}


 
at=theform.email.value.indexOf("@");
if (at == -1)
	{
	alert("Invalid E-Mail");
	theform.email.focus();
	return false;
	}
at=theform.email.value.indexOf(".");
if (at == -1)
	{
	alert("Invalid E-Mail");
	theform.email.focus();
	return false;
	}
if (theform.persontitle.value == '')
	{
	alert("You should write your Name");
	theform.persontitle.focus();
	return false;
	}
if (theform.position.value == '')
	{
	alert("You should write your position");
	theform.position.focus();
	return false;
	}  
	
	if (theform.directphone.value == '')
	{
	alert("You should Write Your Direct Phone");
	theform.directphone.focus();
	return false;
	}


at=theform.email1.value.indexOf("@");
if (at == -1)
	{
	alert("Invalid E-Mail");
	theform.email1.focus();
	return false;
	}
at=theform.email1.value.indexOf(".");
if (at == -1)
	{
	alert("Invalid E-Mail");
	theform.email1.focus();
	return false;
	}
if (theform.establishyear.value == '')
	{
	alert("You should Write Establish year");
	theform.establishyear.focus();
	return false;
	}



ind=theform.companytype.selectedIndex;
	if(theform.companytype[ind].value=="0")
	{
		alert("Select your company type");
		theform.companytype.focus();
		return false;
	}
	
    if(theform.companytype[ind].value=="other")
	{
		val=theform.othercompanytype.value;
			len=val.length;
			if (val=='')
			{
				alert ("You should Write your Other company type");
				theform.othercompanytype.focus();
				return false;
				
			}	
      }
			
			
			
			

ind=theform.businessfield.selectedIndex;
	if(theform.businessfield[ind].value=="0")
	{
		alert("Select your business field");
		theform.businessfield.focus();
		return false;
	}
	
    if(theform.businessfield[ind].value=="other")
	{
		val=theform.otherbusinessfield.value;
			len=val.length;
			if (val=='')
			{
				alert ("You should Write your Other business field");
				theform.otherbusinessfield.focus();
				return false;
				
			}	
     }			
			
	
}