function validate(form)
{	
	var regExp=new RegExp('^[a-z0-9]+$');
	var regExpN=new RegExp('^[A-Za-z ]*$');
	var regExp_null=new RegExp('^[ ]*$');
	var regExpPhExt=new RegExp('^[0-9]+$');
		
		var userid=eval("form.uname.value");
		if (regExp_null.test(userid) || userid=='')
		{
			alert("Enter the choice of your Username");
			form.uname.focus();
			return	false;
		}
		else if (!regExp.test(userid))
		{
			alert("Please enter valid user name");
			form.uname.focus();
			return	false;
		}
		
		if ((document.getElementById("check_uname_div").innerHTML == '<font color="red">Sorry! username already in use.</font>') || (document.getElementById("check_uname_div").innerHTML == '<FONT color=red>Sorry! username already in use.</FONT>'))
		{
			alert ("Username already exists.");
			form.uname.value="";
			form.uname.focus();
			return false;
		}
		
		var pwd=eval("form.pass.value");
		if (regExp_null.test(pwd) || pwd=='')
		{
			alert("Enter the choice of your Password");
			form.pass.focus();
			return false;
		}
		else if (!regExp.test(userid))
		{
			alert("Please enter valid Password");
			form.pass.focus();
			return	false;
		}
		
		var cpwd=eval("form.cpass.value");
		if (regExp_null.test(cpwd) || cpwd=='')
		{
			alert("You need to confirm your password");
			form.cpass.focus();
			return false;
		}
		else if(form.pass.value != form.cpass.value)
	{
			alert("Confirm password doesnt matches with the given password");
			form.cpass.focus();
			return	false;
	}	
	var useridVal = form.uname.value;
	var passwordVal=form.pass.value;
	if ( useridVal != '' && passwordVal != '' && (useridVal.toLowerCase() == passwordVal.toLowerCase()) )
	{
		alert("Username and Password should not be same");
		form.pass.focus();
		return false;
	}
	
//email Verification
 function verifyemail(addr)
  {
      var invalidchar="\/|'\\;,:?!<>=()[](\`~^%$#&*;"  ;
		  for(i=0;i<invalidchar.length;i++)
		   {
		      if(addr.indexOf(invalidchar.charAt(i),0) > -1)
		        {
					alert("email Id Contain invalid character");
					form.pemail.value="";
					form.pemail.focus();
					return(false);
		        }
		  }
		   var atpos=addr.indexOf("@",0);
		    if(addr.indexOf("@",0)== -1)
		        {
					alert("email Id Must Contain a @ in The Domain Name");
					form.pemail.value="";
					form.pemail.focus();
					return(false);
		        }
		   if(atpos==0)
		     {
				alert("email Id must not start with @");
				form.pemail.value="";
				form.pemail.focus();
				return(false);
		     } 
		      if(addr.indexOf("@",atpos+1)>-1)
		       {
					alert("email Id Must contain @ only one");
					form.pemail.value="";
					form.pemail.focus();
					return(false); 
		       } 
		      if(addr.indexOf(".",atpos)== -1)
		        {
					alert("email Id Must Contain a Period in The Domain Name");
				   form.pemail.value="";
				   form.pemail.focus();
					return(false);
		        } 
		        if(addr.indexOf("@.",0)!=-1)
		         {
					alert("Period must not immediately follow @ in Email");
					form.pemail.value="";
					form.pemail.focus();
					return(false) 
		         }
		         if(addr.indexOf("..",0)!=-1)
		          {
					alert("Two Periods must not be adjacent in email Address");
					form.pemail.value="";
					form1.pemail.focus();
					return(false)
		          }
		          if(addr.lastIndexOf(".")== (addr.length - 1) )
		          {
					alert("Period Connot be the last character in Email");
					form.pemail.value="";
					form.pemail.focus();
					return(false);
		          }
		      return true;
	 }
	 
	 if ((document.getElementById("check_email_div").innerHTML == '<font color="red">Sorry! Email already registered with us.</font>') || (document.getElementById("check_email_div").innerHTML == '<FONT color=red>Sorry! Email already registered with us.</FONT>'))
		{
			alert ("Email already exists.");
			form.pemail.value="";
			form.pemail.focus();
			return false;
		}
		
	if(!verifyemaila(form.pemail.value))
      {
        return false;
      }
function verifyemaila(addr)
  {
      var invalidchar="\/|'\\;,:?!<>=()[](\`~^%$#&*;"  ;
		  for(i=0;i<invalidchar.length;i++)
		   {
		      if(addr.indexOf(invalidchar.charAt(i),0) > -1)
		        {
					alert("email Id Contain invalid character");
					form.pemail.value="";
					form.pemail.focus();
					return(false);
		        }
		  }
		   var atpos=addr.indexOf("@",0);
		    if(addr.indexOf("@",0)== -1)
		        {
					alert("email Id Must Contain a @ in The Domain Name");
					form.pemail.value="";
					form.pemail.focus();
					return(false);
		        }
		   if(atpos==0)
		     {
				alert("email Id must not start with @");
				form.pemail.value="";
				form.pemail.focus();
				return(false);
		     } 
		      if(addr.indexOf("@",atpos+1)>-1)
		       {
					alert("email Id Must contain @ only one");
					form.pemail.value="";
					form.pemail.focus();
					return(false); 
		       } 
		      if(addr.indexOf(".",atpos)== -1)
		        {
					alert("email Id Must Contain a Period in The Domain Name");
				   form.pemail.value="";
				   form.pemail.focus();
					return(false);
		        } 
		        if(addr.indexOf("@.",0)!=-1)
		         {
					alert("Period must not immediately follow @ in Email");
					form.pemail.value="";
					form.pemail.focus();
					return(false) 
		         }
		         if(addr.indexOf("..",0)!=-1)
		          {
					alert("Two Periods must not be adjacent in email Address");
					form.pemail.value="";
					form1.pemail.focus();
					return(false)
		          }
		          if(addr.lastIndexOf(".")== (addr.length - 1) )
		          {
					alert("Period Connot be the last character in Email");
					form.pemail.value="";
					form.pemail.focus();
					return(false);
		          }
		      return true;
 		}
		var cname=eval("form.cname.value");
		if (regExp_null.test(cname) || cname=='')
		{
			alert("Enter your Contact Name!");
			form.cname.focus();
			return	false;
		}
		var desc=eval("form.design.value");
		if (regExp_null.test(desc) || desc=='')
		{
			alert("Enter your Designation!");
			form.design.focus();
			return	false;
		}
		else if (!regExpN.test(desc))
		{
			alert("Invalid Designation");
			form.design.focus();
			return	false;
		}
		//Office No.
		var phone2=eval("form.phone2.value");
		if (regExp_null.test(phone2) || phone2=='')
		{
			alert("Enter your Office Contact Phone No.!");
			form.phone2.focus();
			return	false;
		}
		else if (!regExpPhExt.test(phone2))
		{
			alert("Office Phone No. must be numeric values only");
			form.phone2.focus();
			return	false;
		}
		else if(phone2.length<6)
		{
			alert("Office Phone No. cannot be lesser than (6)");
			form.phone2.focus();
			return	false;
		}
		else if(phone2.length>15)
		{
			alert("Office Phone No. cannot be greater than (15)");
			form.phone2.focus();
			return	false;
		}
		/*Mobile*/
		var mobile=eval("form.mobile.value");
		if (regExp_null.test(mobile) || mobile=='')
		{
			alert("Enter your Mobile No.!");
			form.mobile.focus();
			return	false;
		}
		else if (!regExpPhExt.test(mobile))
		{
			alert("Mobile No. must be numeric values only");
			form.mobile.focus();
			return	false;
		}
		else if(mobile.length<7)
		{
			alert("Mobile No. cannot be lesser than (7)");
			form.mobile.focus();
			return	false;
		}
		else if(mobile.length>15)
		{
			alert("Mobile No. cannot be greater than (15)");
			form.mobile.focus();
			return	false;
		}
		
		
		if ((document.getElementById("check_mobile_div").innerHTML == '<font color="red">Sorry! Mobile already registered with us.</font>') || (document.getElementById("check_mobile_div").innerHTML == '<FONT color=red>Sorry! Mobile already registered with us.</FONT>'))
		{
			alert ("Mobile already exists.");
			form.mobile.value="";
			form.mobile.focus();
			return false;
		}
		
		var comp=eval("form.compname.value");
		if (regExp_null.test(comp) || comp=='')
		{
			alert("Enter your Company Name");
			form.compname.focus();
			return	false;
		}
		
		if (!isNaN(form.compname.value))
		{
			alert("Company Name cannot be Numeric");
			form.compname.focus();
			return	false;
		}
		
		var adds=eval("form.compaddress.value");
		if (regExp_null.test(adds) || adds=='')
		{
			alert("Enter Company Address!");
			form.compaddress.focus();
			return	false;
		}
		
		if(form.country.clicked)
		 return true;

		if(form.country.value == "")
	{
		alert("Please Select your country");
		form.country.focus();
		return	false;
	}
	
	if(form.other_sta) {
	if (form.other_sta.checked== true )
	{
		if(form.other_state.value == "")
		{
			alert("Please Enter State");
			form.other_state.focus();
			return	false;
		}	
	
	}
	else
	{  
		if(form.T7.value == "")
		{
			alert("Please Select your State");
			form.T7.focus();
			return	false;
		}
	}
	}
	else
	{
	if(form.T7.value == "")
		{
			alert("Please Select your State");
			form.T7.focus();
			return	false;
		}	
	}
	
	
	
	
	if(form.other_cit) {
	if (form.other_cit.checked== true )
	{
		if(form.other_city.value == "")
		{
			alert ("Please Enter City");
			form.other_city.focus();
			return false;
		}	
	}
	else
	{
		if(form.T8.value == "")
		{
			alert("Please Select your City");
			form.T8.focus();
			return	false;
		}
	}
	}
	else
	{
		if(form.T8.value == "")
		{
			alert("Please Select your City");
			form.T8.focus();
			return	false;
		}
	
	}
	
	
	
	if(form.indtype.value == "")
	{
		alert("Please select Company Category Type");
		form.indtype.focus();
		return	false;
	}
	if(form.compcat.value == "")
	{
		alert("Please select the Sector of the company");
		form.compcat.focus();
		return	false;
	}
	var textarea=tinyMCE.get('compprofile').getContent(); 
	if ((textarea=="") || (textarea==null)) 
	{
			alert("Please enter Company Profile");
			tinyMCE.get('compprofile').focus();
			return false; 
	}
	
	if (form.vercode.value=='')
		{
			alert ("Please Enter Verification Code");
			form.vercode.value="";
			form.vercode.focus();
			return false;
		}
		
		
	
	if (form.vercode.value != form.vercode_check.value)
		{
			alert ("Incorrect Verification Code");
			form.vercode.value="";
			form.vercode.focus();
			return false;
		}
		
		
		if (form.in_resume_1_termsconditions.checked==false)
		{
			alert ("You need to accept Terms and Conditions.");
			return false;
		}
		
		
		
}
