// Validate initial section
function s1() {
   var check;
   var check2;
   check=document.getElementById('amount').value;
   if (check=="") {
      alert('Please tell us how much you wish to borrow');
      document.form.amount.focus();
      return false;}
  document.getElementById('s1').style.visibility = 'visible';
  document.getElementById("s1").style.display="block";
  document.getElementById('startshow').style.visibility = 'hidden';
  document.form.status.focus();
  return false;
}
 
// Validate section 1 + Show section 2
function s2() {
   var check;
   var check2;
   check=document.getElementById('status').value;
   if (check=="") {
      alert('Please check the residential status box');
      document.form.status.focus();
      return false;}
 
   check=document.getElementById('dobdd').value;
   if (check=="") {
      alert('Please tell us the day of the month, for your date of birth');
      document.form.dobdd.focus();
      return false;}
   check=document.getElementById('dobmm').value;
   if (check=="") {
      alert('Please tell us the month, for your date of birth');
      document.form.dobmm.focus();
      return false;}
   check=document.getElementById('dobyy').value;
   if (check=="") {
      alert('Please tell us the year, of your date of birth');
      document.form.dobyy.focus();
      return false;}
   check=document.getElementById('marital').value;
   if (check=="") {
      alert('Please tell us your marital status');
      document.form.marital.focus();
      return false;}

   check=document.getElementById('employment').value;
   if (check=="") {
      alert('Please tell us about your employment');
      document.form.employment.focus();
      return false;}
   check=document.getElementById('income').value;
   if (check=="") {
      alert('Please tell us about your income');
      document.form.income.focus();
      return false;}
 
   check=document.getElementById('reside').value;
   if (check=="") {
      alert('Please tell us whether you permanent rights to reside in the UK');
      document.form.reside.focus();
      return false;}
  document.getElementById('s2').style.visibility = 'visible';
  document.getElementById("s2").style.display="block";
  document.getElementById('s1show').style.visibility = 'hidden';
  document.form.sal.focus();
  return false;
}
 
 
 
// Validate section 2 + Show section 3
function s3() {
   var check;
   var check2;
   check=document.getElementById('sal').value;
   if (check=="") {
      alert('Please choose your title');
      document.form.sal.focus();
      return false;}
 
   check=document.getElementById('first').value;
   if (check=="") {
      alert('Please tell us your first name');
      document.form.first.focus();
      return false;}
   check=document.getElementById('surname').value;
   if (check=="") {
      alert('Please tell us your surname');
      document.form.surname.focus();
      return false;}

   check=document.getElementById('address').value;
   if (check=="") {
      alert('Please tell us your address');
      document.form.address.focus();
      return false;}
 
   check=document.getElementById('postcode').value;
   if (check=="") {
      alert('Please tell us your postcode');
      document.form.postcode.focus();
      return false;}
   check=document.getElementById('phone').value;
   if (check=="") {
      alert('Please tell us your phone number');
      document.form.phone.focus();
      return false;}

   check=document.getElementById('when').value;
   if (check=="") {
      alert('Please tell us the best day to call you');
      document.form.when.focus();
      return false;}
 
   check=document.getElementById('calltime').value;
   if (check=="") {
      alert('Please tell us the best time to call you');
      document.form.calltime.focus();
      return false;}
  document.getElementById('s3').style.visibility = 'visible';
  document.getElementById("s3").style.display="block";
  document.getElementById('s2show').style.visibility = 'hidden';
  document.form.title2.focus();
  return false;
}
 
 
 
// Validate section 3 + Show section 4
function s4() {
   var check;
   var check2;
   var yourStatus=document.getElementById('marital').value;
   if (yourStatus=="Married") {
   check=document.getElementById('title2').value;
   if (check=="") {
      alert('Please choose your partners title');
      document.form.title2.focus();
      return false;}
 
   check=document.getElementById('first2').value;
   if (check=="") {
      alert('Please tell us your partners first name');
      document.form.first2.focus();
      return false;}
 
   check=document.getElementById('surname2').value;
   if (check=="") {
      alert('Please tell us your partners surname');
      document.form.surname2.focus();
      return false;}
 
   check=document.getElementById('dobdd2').value;
   if (check=="") {
      alert('Please tell us the day of the month, for your partners date of birth');
      document.form.dobdd2.focus();
      return false;}
   check=document.getElementById('dobmm2').value;
   if (check=="") {
      alert('Please tell us the month, for your partners date of birth');
      document.form.dobmm2.focus();
      return false;}
   check=document.getElementById('dobyy2').value;
   if (check=="") {
      alert('Please tell us the year, of your partners date of birth');
      document.form.dobyy2.focus();
      return false;}
   check=document.getElementById('marital2').value;
   if (check=="") {
      alert('Please tell us your partners marital status');
      document.form.marital2.focus();
      return false;}
 
   check=document.getElementById('employment2').value;
   if (check=="") {
      alert('Please tell us about your partners employment');
      document.form.employment2.focus();
      return false;}

 
   check=document.getElementById('phone2').value;
   if (check=="") {
      alert('Please tell us your partners phone number');
      document.form.phone2.focus();
      return false;}
   check=document.getElementById('reside2').value;
   if (check=="") {
      alert('Please tell us whether your partner has permanent rights to reside in the UK');
      document.form.reside2.focus();
      return false;}
} // married
 
 
  document.getElementById('s4').style.visibility = 'visible';
  document.getElementById("s4").style.display="block";
  document.getElementById('s3show').style.visibility = 'hidden';
  document.form.propertyvalue.focus();
  return false;
}
 
 
// Validate section 4 + Show section 5
function s5() {
   var check;
   var check2;
   check=document.getElementById('propertyvalue').value;
   if (check=="") {
      alert('Please tell us the value of your property');
      document.form.propertyvalue.focus();
      return false;}

   check=document.getElementById('mortbal').value;
   if (check=="") {
      alert('Please tell us the outstanding balance of your mortgage');
      document.form.mortbal.focus();
      return false;}

 
   check=document.form.accept;
   if (check.checked!==true) {
      alert('Please accept the terms and conditions');
//      document.form.otheramount.focus();
      return false;}
 
   document.form.submit();
 
}
 
// show 1st section
function FormSections() {
   document.getElementById('s1').style.visibility = 'hidden';
   document.getElementById('s2').style.visibility = 'hidden';
   document.getElementById('s3').style.visibility = 'hidden';
   document.getElementById('s4').style.visibility = 'hidden';
   document.getElementById("s1").style.display="none";
   document.getElementById("s2").style.display="none";
   document.getElementById("s3").style.display="none";
   document.getElementById("s4").style.display="none";
}
 
function tc() {
  tcwin=window.open('tc.shtml','TC', 'width=400,height=200,status=no,resizable=no,scrollbars=yes,top=200,left=200,dependent=yes,alwaysRaised=yes');
  tcwin.focus();
  }
window.onload = FormSections;

 
 


