// Expression of Interest Scripts //
// All Scripts built by Mitchell Anderson //

//Change Visibility //
function changeVisibility_check(element,visibilityMode,field){
if (document.getElementById(field).value == "Other"){
document.getElementById(element).style.visibility = visibilityMode;
}
else{
document.getElementById(element).style.visibility = "hidden";
}
}

//COMPLETE VALIDATION begin//
function validate(){
var missinginfo = "";
var missinginfo2 = "";
//Form Fields //
var venue = document.Expression_of_Interest_Form.venue.value;
var day_of_week = document.Expression_of_Interest_Form.day_of_week.value;
var time_of_day = document.Expression_of_Interest_Form.time_of_day.value;
var name = document.Expression_of_Interest_Form.name.value;
var contact_phone = document.Expression_of_Interest_Form.contact_phone.value;
var email = document.Expression_of_Interest_Form.email.value;

//Statements //
if (venue == "nil"){
missinginfo += "\n     - Venue";
}
if (day_of_week == "nil"){
missinginfo += "\n     - Day (of Week)";
}
if (time_of_day == "nil"){
missinginfo += "\n     - Time";
}
if (name == ""){
missinginfo += "\n     - Name";
}
if (contact_phone == ""){
missinginfo += "\n     - Contact Phone Number";
}
if (email == ""){
missinginfo += "\n     - Email Address";
}
if ((email == "") || (email.indexOf('@') == -1) || (email.indexOf('.') == -1)){
missinginfo2 += "\n     - Email Address is not valid";
}

if ((missinginfo != "") || (missinginfo2 != "")){
message = "Form cannot be submitted!\n" + "The following details were not entered:\n" + "____________________________\n" + missinginfo + "\n____________________________\n" + "The following error(s) occured:\n" + missinginfo2 + "\n____________________________\n" + "Please re-enter and submit again. Thank you!\n";
alert(message);
return false;
}
else
return true;
}
//COMPLETE VALIDATION end//