<!-- 
// updated 23 October 2004
// this file is http://olscc.gov.uk/js/olsccmail.js

function validate(form) {
// next line prevents accidental duplicates - it may be commented out for testing
if (sourceOK(form) == false ||
descriptionOK(form) == false ||
descriptionchoiceother(form) == false ||
letter1OK(form) == false ||
letter2OK(form) == false ||
letter3OK(form) == false ||
letter4OK(form) == false ||
letter5OK(form) == false ||
inforate1OK(form) == false ||
inforate2OK(form) == false ||
inforate3OK(form) == false ||
inforate4OK(form) == false ||
service1OK(form) == false ||
service2OK(form) == false ||
service3OK(form) == false ||
complain1OK(form) == false ||
complain2OK(form) == false ||
complain3OK(form) == false ||
complaintolawsocOK(form) == false ||
lawcomplain1OK(form) == false ||
lawcomplain2OK(form) == false ||
lawcomplain3OK(form) == false ||
lawcomplain4OK(form) == false ||
lawcomplain5OK(form) == false ||
lawcomplain6OK(form) == false ||
lawcomplain7OK(form) == false ||
lawcomplain8OK(form) == false ||
lawcomplain9OK(form) == false ||
//postcodeOK(form) == false ||
//emailOK(form) == false ||
//q1aOK(form) == false ||
//officechoiceother(form) == false ||
//issueOK(form) == false ||
//issuechoiceother(form) == false ||
//commentOK(form) == false ||
//commentlengthOK(form) == false ||
descriptionOK(form) == false)  {
 return false;
  }
else {
 form.source.value = "web";
 form.datesent.value = datetext();
 document.location = "#end" ;
 form.submitform.title = "Your message is being sent \n This may take up to a minute." ;
// q15sendvalue(form);
// issueconcatonate(form);
 return true;
 form.reset();
  }
}

function descriptionOK(form) {
  if (form.description.value == "Not Selected") {
                  form.description.focus();
         alert("Please select an option which best describes the case \n  your solicitor is dealing with for you.");
      document.location = "#description" ;
   return false;
 }
  else {
   return true;
   }
}

function descriptionchoiceother(form) {
  if (form.description.value == "Other" ) {
   anotherbox = document.getElementById("othercase");
   anotherbox.style.display='block';
   if ((form.other.value == "" ) || (form.other.value == "Please advise..." )) {
       form.other.title = "Please provide a couple of words \n to describe the nature of the case.";
       form.other.style.background = "#fff8dd" ;
       form.other.focus();
             alert("Please provide a couple of words \n to describe the nature of the case.");
    document.location = "#description" ;
       return false;
   }
    else {
     form.other.title = "Brief description of your case.";
     form.other.style.background = "#fff" ;
          return true;
     }
  }
    else {
   form.other.value = "" ;
   anotherbox = document.getElementById("othercase");
   anotherbox.style.display='none';
  }
}
function letter1OK(form) {
  if (form.letter1.value == "Not Selected") {
                  form.letter1.focus();
         alert("Please indicate whether a client care letter \n  set out what you had asked your solicitor to do.");
      document.location = "#ccletter" ;
   return false;
 }
  else {
   return true;
   }
}
function letter2OK(form) {
  if (form.letter2.value == "Not Selected") {
                  form.letter2.focus();
         alert("Please indicate whether a client care letter \n  set out the name of the person handling your case.");
      document.location = "#ccletter" ;
   return false;
 }
  else {
   return true;
   }
}
function letter3OK(form) {
  if (form.letter3.value == "Not Selected") {
                  form.letter3.focus();
         alert("Please indicate whether a client care letter \n  set out the likely cost.");
      document.location = "#ccletter" ;
   return false;
 }
  else {
   return true;
   }
}
function letter4OK(form) {
  if (form.letter4.value == "Not Selected") {
                  form.letter4.focus();
         alert("Please indicate whether a client care letter \n  set out the likely time it would take.");
      document.location = "#ccletter" ;
   return false;
 }
  else {
   return true;
   }
}
function letter5OK(form) {
  if (form.letter5.value == "Not Selected") {
                  form.letter5.focus();
         alert("Please indicate whether a client care letter \n  set out the name of the person to contact if you want to complain.");
      document.location = "#ccletter" ;
   return false;
 }
  else {
   return true;
   }
}
function inforate1OK(form) {
  if (form.inforate1.value == "0") {
                  form.inforate1.focus();
         alert("How would you rate your solicitor \n in giving you clear explantions?");
      document.location = "#inforate" ;
   return false;
 }
  else {
   return true;
   }
}
function inforate2OK(form) {
  if (form.inforate2.value == "0") {
                  form.inforate2.focus();
         alert("How would you rate your solicitor \n in giving you accurate and full information?");
      document.location = "#inforate" ;
   return false;
 }
  else {
   return true;
   }
}
function inforate3OK(form) {
  if (form.inforate3.value == "0") {
                  form.inforate3.focus();
         alert("How would you rate your solicitor \n in keeping you up to date on progress?");
      document.location = "#inforate" ;
   return false;
 }
  else {
   return true;
   }
}
function inforate4OK(form) {
  if (form.inforate4.value == "0") {
                  form.inforate4.focus();
         alert("How would you rate your solicitors \n in doing what you instructed them to do?");
      document.location = "#inforate" ;
   return false;
 }
  else {
   return true;
   }
}
function inforate5OK(form) {
  if (form.inforate5.value == "0") {
                  form.inforate5.focus();
         alert("How would you rate your solicitor \n in telling you about any increase in costs \n and asking for your agreement?");
      document.location = "#inforate" ;
   return false;
 }
  else {
   return true;
   }
}
function formatsOK(form) {
  if (form.formats.value == "Not Selected") {
                  form.formats.focus();
         alert("Did your solicitor provide information \n in other formats if you needed it?");
      document.location = "#formats" ;
   return false;
 }
  else {
   return true;
   }
}
function disabilityOK(form) {
  if (form.disability.value == "Not Selected") {
                  form.disability.focus();
         alert("If you have a disability \n did your solicitor discuss \n the best way to help you?");
      document.location = "#formats" ;
   return false;
 }
  else {
   return true;
   }
}
function service1OK(form) {
  if (form.service1.value == "0") {
                  form.service1.focus();
         alert("How would you rate your solicitor \n in acting without delay?");
      document.location = "#service" ;
   return false;
 }
  else {
   return true;
   }
}
function service2OK(form) {
  if (form.service2.value == "0") {
                  form.service2.focus();
         alert("How would you rate your solicitor in \n replying to your phone calls and letters \n within a reasonable time?");
      document.location = "#service" ;
   return false;
 }
  else {
   return true;
   }
}
function service3OK(form) {
  if (form.service3.value == "0") {
                  form.service3.focus();
         alert("How would you rate your solicitor in \n treating you fairly and with respect?");
      document.location = "#service" ;
   return false;
 }
  else {
   return true;
   }
}
function complain1OK(form) {
  if (form.complain1.value == "0") {
                  form.complain1.focus();
         alert("How would you rate your solicitor's explanation about \n their procedures for dealing with complaints?");
      document.location = "#complaints" ;
   return false;
 }
  else {
   return true;
   }
}
function complain2OK(form) {
  if (form.complain2.value == "0") {
                  form.complain2.focus();
         alert("How would you rate your solicitor's \n explanation about the length of time you \n should wait for a reply to your complaint?");
      document.location = "#complaints" ;
   return false;
 }
  else {
   return true;
   }
}
function complain3OK(form) {
  if (form.complain3.value == "0") {
                  form.complain3.focus();
         alert("How would you rate your solicitor's explanation about \n how you can complain to the Law Society?");
      document.location = "#complaints" ;
   return false;
 }
  else {
   return true;
   }
}
function complaintolawsocOK(form) {
  if (form.complaintolawsoc.value == "Not Selected") {
                  form.complaintolawsoc.focus();
         alert("Did you go on to complain \n to the Law Society?");
      document.location = "#complaints" ;
   return false;
 }
  else {
   return true;
   }
}
function lawsocietychoice(form) {
  if (form.complaintolawsoc.value == "yes" ) {
   lawsocquestions = document.getElementById("lawsociety");
   lawsocquestions.style.display ='block';
 }
    else {
   lawsocquestions = document.getElementById("lawsociety");
   lawsocquestions.style.display ='none';
  }
}

function lawcomplain1OK(form) {
  if ((form.complaintolawsoc.value == "yes" ) && (form.lawcomplain1.value == "0")) {
                  form.lawcomplain1.focus();
         alert("How would you rate the way that the Law Society \n explained how they would deal with your complaint?");
   document.location = "#lawsoc" ;
   return false;
 }
  else {
   return true;
   }
}
function lawcomplain2OK(form) {
  if ((form.complaintolawsoc.value == "yes" ) && (form.lawcomplain2.value == "0")) {
                  form.lawcomplain2.focus();
         alert("How would you rate the way that the Law Society \n asked your solicitor to give an explanation?");
   document.location = "#lawsoc" ;
   return false;
 }
  else {
   return true;
   }
}
function lawcomplain3OK(form) {
  if ((form.complaintolawsoc.value == "yes" ) && (form.lawcomplain3.value == "0")) {
                  form.lawcomplain3.focus();
         alert("How would you rate the way that the Law Society \n gave you the chance to comment about what your solicitor said?");
   document.location = "#lawsoc" ;
   return false;
 }
  else {
   return true;
   }
}

function lawcomplain4OK(form) {
  if ((form.complaintolawsoc.value == "yes" ) && (form.lawcomplain4.value == "0")) {
                  form.lawcomplain4.focus();
                  alert("How would you rate the way that the Law Society \n helped you and your solicitor reach an agreement?");
   document.location = "#lawsoc" ;
   return false;
 }
  else {
   return true;
   }
}
function lawcomplain5OK(form) {
  if ((form.complaintolawsoc.value == "yes" ) && (form.lawcomplain5.value == "0")) {
                  form.lawcomplain5.focus();
                  alert("How would you rate the way that the Law Society \n kept you up to date about the progress they were making?");
   document.location = "#lawsoc" ;
   return false;
 }
  else {
   return true;
   }
}
function lawcomplain6OK(form) {
  if ((form.complaintolawsoc.value == "yes" ) && (form.lawcomplain6.value == "0")) {
                  form.lawcomplain6.focus();
                  alert("How would you rate the way that the Law Society \n replied to your letters and phone calls within a reasonable time?");
   document.location = "#lawsoc" ;
   return false;
 }
  else {
   return true;
   }
}
function lawcomplain7OK(form) {
  if ((form.complaintolawsoc.value == "yes" ) && (form.lawcomplain7.value == "0")) {
                  form.lawcomplain7.focus();
                  alert("How would you rate the way that the Law Society \n told you how to decide if your solicitor's charges are fair?");
                    document.location = "#lawsoc" ;
   return false;
 }
  else {
   return true;
   }
}
function lawcomplain8OK(form) {
  if ((form.complaintolawsoc.value == "yes" ) && (form.lawcomplain8.value == "0")) {
                  form.lawcomplain8.focus();
                  alert("How would you rate the way that the Law Society \n treated you in a polite and helpful way?");                      document.location = "#lawsoc" ;
   return false;
 }
  else {
   return true;
   }
}
function lawcomplain9OK(form) {
  if ((form.complaintolawsoc.value == "yes" ) && (form.lawcomplain9.value == "0")) {
                  form.lawcomplain9.focus();
                  alert("How would you rate the way that the Law Society \n told you when and how you can complain to the Legal Services Ombudsman?");
                    document.location = "#lawsoc" ;
   return false;
 }
  else {
   return true;
   }
}

// to here 26 Oct 2004
function sourceOK(form) {
  if (form.source.value == "web")  {
         alert("Your message has already been sent");
   form.submitform.title ="Your message has been sent." ;
   return false;
    }
  else {
   return true;
   }
}
// to here 26 Oct 2004

function usernameOK(form) {
  if (form.username.value == "" ||
  form.username.value == "Please enter your name here..." ||
  form.username.value.length < 3 )  {
   form.username.focus(); 
               alert("Please give your name");
   return false;
    }
  else {
   return true;
   }
}

// email
function emailOK(form) {
 var maila = form.email.value.indexOf('@', 0);
 var mailb = form.email.value.lastIndexOf('@');
 var mailc = form.email.value.length - 1 ;
  if (form.email.value == "" ||      // empty
      form.email.value.indexOf('@', 0) == -1 ||   // no @ sign
      form.email.value.lastIndexOf('@') == 0 ||  // @ sign at begining
 form.email.value.lastIndexOf('@') > form.email.value.lastIndexOf('\.') || // @ sign after last dot
  // or no dot
 form.email.value.lastIndexOf('\.') > form.email.value.length -3 || // dot less than two char from end
// @ sign at end
 form.email.value.lastIndexOf('@') == form.email.value.length - 1) {   
 document.location ="#email" ;
 //form.email.focus(); 
 alert("Please give your full email address.\n \n (for example: Your.Name@...........)");
 return false;
  }
  else {
   return true;
   }
}

// confidential
function q1aOK(form) {
  if (form.q1_conf[0].checked == false && 
      form.q1_conf[1].checked == false) {
   document.location ="#q1" ;
               alert("Do you want your comments to remain confidential? \n \n Please tick 'Yes' or 'No'.");
     
     return false;
     }
  else {
   return true;
   }
}

function commentlengthOK(form) {
  if (form.comments.value.length > 2300 )  {
   form.comments.focus(); 
               alert("Your message should be less than 300 words \n  \n Please edit your message to make it shorter.");
   return false;
    }
  else {
   return true;
   }
}

function datetext() {
var now = new Date();
var dateno = now.getDate();
var year = now.getYear();
var month = now.getMonth();
var dateresult = "unknown";
         if (month == 0) monthname = "January";
         if (month == 1) monthname = "February";
         if (month == 2) monthname = "March";
         if (month == 3) monthname = "April";
         if (month == 4) monthname = "May";
         if (month == 5) monthname = "June";
         if (month == 6) monthname = "July";
         if (month == 7) monthname = "August";
         if (month == 8) monthname = "September";
         if (month == 9) monthname = "October";
         if (month == 10) monthname = "November";
         if (month == 11) monthname = "December";
dateresult =dateno + " " + monthname + " " + year;
return dateresult;
}

// document.write("<p><b>Test version for use on " + datetext()+ " </b></p>")

// -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title></title>
  </head>
  <body>
  </body>
</html>
