function regvalidation()
{
var type=/^[a-zA-Z\s]+$/;
var alpha_num=/^[a-zA-Z0-9\.\_\-\,\'S]+$/;
var email_type=/^[a-zA-Z0-9\.\_\-\'S]+@[a-zA-Z\S]+\.([a-zA-Z]{2,4})+$/;
var address=/^[a-zA-Z0-9\,\;\-\/\.\s]+$/;
var code=/^[a-zA-z0-9\s]+$/;
var Number=/^[0-9\s]+$/;

 	//first name
	if(document.getElementById('firstName').value==0)
	{
		return required('firstName','efirstName','Should not be null');
	}
	if(!(type.test(document.getElementById('firstName').value)))
	{
		return match('firstName','efirstName','Please use alphabets only',type);
	}
	
	
	//initials
	if(document.getElementById('lastName').value==0)
	{
		return required('lastName','elastName','Should not be null');
	}
	if(!(type.test(document.getElementById('lastName').value)))
	{
		return match('lastName','elastName','Please use alphabets only',type);
	}	
	
	if(document.getElementById('address1').value==0)
	{
		return required('address1','eaddress1','Should not be null');
	}
	if(!(address.test(document.getElementById('address1').value)))
	{
		return match('address1','eaddress1','Please dont use specialcharacters',type);
	}
     
	/*if(document.getElementById('address2').value==0)
	{
		return required('address2','eaddress2','Should not be null');
	}
	if(!(address.test(document.getElementById('address2').value)))
	{
		return match('address2','eaddress2','Please dont use specialcharacters',type);
	} */
	
	if(document.getElementById('county').value==0)
	{
		return required('county','ecounty','Should not be null');
	}
	if(!(type.test(document.getElementById('county').value)))
	{
		return match('county','ecounty','Please dont use specialcharacters',type);
	} 
	
	if(document.getElementById('postCode').value==0)
	{
		return required('postCode','epostCode','Should not be null');
	}
	if(!(code.test(document.getElementById('postCode').value)))
	{
		return match('postCode','epostCode','Please  use Alphanumeric characters only ',type);
	} 
	
	if(document.addCandidate.day.value=="")
	{
	return required('day','eday','pls select date');
	}
	if(document.addCandidate.month.value=="")
	{
	return required('month','emonth','pls select month');
	}
	if(document.addCandidate.year.value=="")
	{
	return required('year','eyear','pls select year');
	}
	
	if(document.addCandidate.Sex.value=="")
	{
	return required('Sex','eSex','pls select your sex');
	}
	
	//email
	if(document.getElementById('email').value==0)
	{
	return required('email','eEmail','Should not be null');
	}
	if(!(email_type.test(document.getElementById('email').value)))
	{
	return match('email','eEmail','Please use example@gmail.com format',email_type);
	}
	
	//telephone
	if(document.getElementById('telephone').value==0)
	{
	return required('telephone','etelephone','Should not be null');
	}
	if(!(Number.test(document.getElementById('telephone').value)))
	{
	return match('telephone','etelephone','Please use numbers only',email_type);
	}
	
	//mobile
	if(document.getElementById('Mobile').value==0)
	{
	return required('Mobile','eMobile','Should not be null');
	}
	if(!(Number.test(document.getElementById('Mobile').value)))
	{
	return match('Mobile','eMobile','Please use numbers only',email_type);
	}
	
	//positions
	if(document.addCandidate.positions.value=="")
	{
	return required('positions','epositions','pls select your positions');
	}
	
	//comments
	/*if(document.getElementById('Comments').value==0)
	{
		return required('Comments','eComments','Should not be null');
	}
	if(!(alpha_num.test(document.getElementById('Comments').value)))
	{
		return match('Comments','eComments','Please use alphabets,numbers,-,.,_,, only',alpha_num);
	}*/
	
	//upload
	/*if(document.getElementById('cv').value==0)
	{
		return required('cv','ecv','Should not be null');
	}*/
	if(document.getElementById('cv').value!=0)
	{
	var fname=document.getElementById("cv").value;
	var ftype=fname.substr(fname.lastIndexOf("."),4);
	if(ftype !=".doc" && ftype !=".docs")
	{
	return required('cv','ecv','Only file of type .doc/.docs is allowed');
	}
	}
}


