function doValidation(data) {
  var errors = [];

  if(!data.areacode.length) {
    errors.push([
      'areacode',
      'Please select the area code of your mobile number.'
    ]);
  }
  if(!/^[0-9]{6}$/.test(data.mobilenumber.replace(/\s+/g, ''))) {
    errors.push([
      'mobilenumber',
      'Please enter your mobile number (6 digits).'
    ]);
  }
  if(!data.provider.length) {
    errors.push([
      'provider',
      'Please select your current service provider from the list.'
    ]);
  }
  if(!data.service.length) {
    errors.push([
      'service',
      'Please select the service you currently have from the list.'
    ]);
  }
  if(!data.title.length) {
    errors.push([
      'title',
      'Please select the service you currently have from the list.'
    ]);
  }
  if(!data.firstname.length) {
    errors.push([
      'firstname',
      'Please enter your first name.'
    ]);
  }
  if(!data.surname.length) {
    errors.push([
      'surname',
      'Please enter your surname.'
    ]);
  }
  if(!data.address1.length) {
    errors.push([
      'address1',
      'Please enter the first line of your address.'
    ]);
  }
  if(!data.parish.length) {
    errors.push([
      'parish',
      'Please enter your parish.'
    ]);
  }
  if(!data.postcode.length) {
    errors.push([
      'postcode',
      'Please enter your postcode.'
    ]);
  }
  if(!data.daytimephone.length) {
    errors.push([
      'daytimephone',
      'Please enter a daytime phone number.'
    ]);
  }
  if(!/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}$/.test(data.email)) {
    errors.push([
      'email',
      'Please enter a valid email address.'
    ]);
  }
  if(!data.password.length || !data.confirmpassword.length) {
    errors.push([
      'password',
      'Please enter your password twice.'
    ]);
  }
  if(data.password!=data.confirmpassword) {
    errors.push([
      'password',
      'Your password and password conformation did not match.'
    ]);
  }
  if(!data.pin.length || !data.confirmpin.length) {
    errors.push([
      'pin',
      'Please enter your PIN twice.'
    ]);
  }
  if(data.pin!=data.confirmpin) {
    errors.push([
      'pin',
      'Your PIN and PIN conformation did not match.'
    ]);
  }
  if(!data.question.length) {
    errors.push([
      'question',
      'Please select a security question from the list.'
    ]);
  }
  if(!data.answer.length) {
    errors.push([
      'answer',
      'Please enter an answer to your security question.'
    ]);
  }
  if(!data.declaration1.length) {
    errors.push([
      'declaration1',
      'Please respond to all of the items in the declaration.'
    ]);
  }
  if(!data.declaration2.length) {
    errors.push([
      'declaration2',
      'Please respond to all of the items in the declaration.'
    ]);
  }
  if(!data.declaration3.length) {
    errors.push([
      'declaration3',
      'Please respond to all of the items in the declaration.'
    ]);
  }
  if(!data.declaration4.length) {
    errors.push([
      'declaration4',
      'Please respond to all of the items in the declaration.'
    ]);
  }
  if(!data.declaration5.length) {
    errors.push([
      'declaration5',
      'Please respond to all of the items in the declaration.'
    ]);
  }
  if(!data.declaration6.length) {
    errors.push([
      'declaration6',
      'Please respond to all of the items in the declaration.'
    ]);
  }
  if(!data.declaration7.length) {
    errors.push([
      'declaration7',
      'Please respond to all of the items in the declaration.'
    ]);
  }
  if(!data.declaration8.length) {
    errors.push([
      'declaration8',
      'Please respond to all of the items in the declaration.'
    ]);
  }
  if(!data.declaration9.length) {
    errors.push([
      'declaration9',
      'Please respond to all of the items in the declaration.'
    ]);
  }
  if(!data.declaration10.length) {
    errors.push([
      'declaration10',
      'Please respond to all of the items in the declaration.'
    ]);
  }

  return errors;
}

