var homeImages = new Array();

homeImages[0] = 'images/home-1.jpg';
homeImages[1] = 'images/home-2.jpg';
homeImages[2] = 'images/home-3.jpg';
homeImages[3] = 'images/home-4.jpg';
homeImages[4] = 'images/home-5.jpg';
homeImages[5] = 'images/home-6.jpg';

var theImage = Math.round(Math.random() * (homeImages.length - 1));

function showImage() {
  document.write('<img src="' + homeImages[theImage] + '" alt="Welcome to Gleaves Swearingen Potter &amp; Scott LLP" />');
}

function enableFields(field1, field2) {
  document.getElementById(field1).disabled = false;
  document.getElementById(field2).disabled = false;
}

function disableFields(field1, field2) {
  document.getElementById(field1).value = "";
  document.getElementById(field1).disabled = true;
  document.getElementById(field2).value = "";
  document.getElementById(field2).disabled = true;
}

function validateForm(formName) {
  var policy = document.forms[formName].elements["policy"].checked;

  var error = false;
  var errorMessage = "";

  if (!policy) {
    error = true;
    errorMessage += "You must agree to and have read the terms stated in the privacy policy before submitting any information.\n";
  }

  if (error) {
    alert(errorMessage);
    return false;
  }
}