// Domestic Repairs Form js

var intQuestionIndex=1;

function imValid() {

    switch (intQuestionIndex) {
        case 1:
            if (document.getElementById("Appliance").selectedIndex == 0) {
                document.getElementById("Appliance").focus();
                alert("Please select type of appliance");
                return false;
            }
            if (document.getElementById("Manufacturer").selectedIndex == 0) {
                document.getElementById("Manufacturer").focus();
                alert("Please select manufacturer");
                return false;
            }
            if (document.quoteme.App_Age.value.length < 1) {
                document.quoteme.App_Age.focus();
                alert("Please tell us the age of your appliance");
                return false;
            }
            intQuestionIndex=2;
// Swap panel to page 2
            document.getElementById('form_1').style.visibility = 'hidden';
            document.getElementById('form_2').style.visibility = 'visible';
            document.getElementById('formButton').src = 'http://www.domesticrepairs.ltd.uk/images/request-quote-button-small.jpg';
            return false;
            break;

        case 2:
            if (document.quoteme.Name.value.length < 2) {
                alert('Please enter your Name');
                return false;
            }
            if (document.quoteme.Area.value.length < 3) {
                alert('Please enter your Post Code / Area');
                return false;
            }
            if (document.quoteme.email.value.indexOf("@") == -1) {
                alert('Please enter your email address');
                return false;
            }
            if (document.quoteme.phone.value.length == 0 && document.quoteme.mobile.value.length == 0) {
                alert('Please let us have a contact phone number');
                return false;
            }
            break;

    }
    return true;

}

function clearForms()
{
  var i;
  for (i = 0; (i < document.forms.length); i++) {
    document.forms[i].reset();
  }
}

