
function validateForm(Contact) {

var reason = "";

  reason += validateName(Contact.name);

  reason += validateAge(Contact.age);

  reason += validateAddress(Contact.address);

  reason += validateEmail(Contact.email);

  reason += validateDistrict(Contact.districts);

  reason += validateContact(Contact.telephone);

  if (reason != "") {

    alert("Some fields need correction:\n" + reason);
    return false;

  }

  return true;

}

function validateName(fld) {

	var error="";

	if (fld.value == "") {

        fld.style.background = 'Red'; 

        error = "You didn't enter the Name.\n";

	} else {

	fld.style.background = 'White';

    }

    return error;

}

function validateAge(fld) {

	var error="";

	if (fld.value == "") {

        fld.style.background = 'Red'; 

        error = "You didn't Select The Email Age.\n";

	} else {

	fld.style.background = 'White';

    }

    return error;

}

function validateAddress(fld) {

	var error="";

	if (fld.value == "") {

        fld.style.background = 'Red'; 

        error = "You didn't enter the Address.\n";

	} else {

	fld.style.background = 'White';

    }

    return error;

}

function validateEmail(fld) {

	var error="";

	if (fld.value == "") {

        fld.style.background = 'Red'; 

        error = "You didn't enter the Email.\n";

	} else {

	fld.style.background = 'White';

    }

    return error;

}

function validateDistrict(fld) {

	var error="";

	if (fld.value == "NoDistrict") {

        fld.style.background = 'Red'; 

        error = "You didn't Select the District.\n";

	} else {

	fld.style.background = 'White';

    }

    return error;

}

function validateContact(fld) {

	var error="";

	if (fld.value == "") {

        fld.style.background = 'Red'; 

        error = "You didn't enter the Contact.\n";

	} else {

	fld.style.background = 'White';

    }

    return error;

}
