﻿//<!--
// Fields validation for E-news Registration Form
function validateEnewsForm(form) {
    // Validate input fields
    var inputList = form.getElementsByTagName("INPUT");
    for (var i = 0; i < inputList.length; i++) {
        if (inputList[i].alt == "required" && inputList[i].value.length == 0) {
            alert("Please fill in the required field : " + inputList[i].id);
            return false;
        }
    }
    var selectCountry = document.getElementById("country");
    if (selectCountry.selectedIndex == 0) {
        alert("Please fill in the required field : " + selectCountry.id);
        return false;
    }
    return true;
}
// Fields validation for Contact Us Form
function validateContactForm(form) {
    // Validate input fields
    var inputList = form.getElementsByTagName("INPUT");
    for (var i = 0; i < inputList.length; i++) {
        if (inputList[i].alt == "required" && inputList[i].value.length == 0) {
            alert("Please fill in the required field : " + inputList[i].id);
            return false;
        }
    }
    var selectCountry = document.getElementById("country");
    if (selectCountry.selectedIndex == 0) {
        alert("Please fill in the required field : " + selectCountry.id);
        return false;
    }
    return true;
}
// Fields validation for Contact Exhibitor Form
function validateContactExForm(form) {
    // Validate input fields
    var inputList = form.getElementsByTagName("INPUT");
    for (var i = 0; i < inputList.length; i++) {
        if (inputList[i].alt == "required" && inputList[i].value.length == 0) {
            alert("Please fill in the required field : " + inputList[i].id);
            return false;
        }
    }
    var selectCountry = document.getElementById("country");
    if (selectCountry.selectedIndex == 0) {
        alert("Please fill in the required field : " + selectCountry.id);
        return false;
    }
    return true;
}

// Fields validation for Contact Exhibitor Form
function validateAppointForm(form) {
    // Validate input fields
    var inputList = form.getElementsByTagName("INPUT");
    for (var i = 0; i < inputList.length; i++) {
        if (inputList[i].alt == "required" && inputList[i].value.length == 0) {
            if (inputList[i].id == "preAppointmentId") {
                alert("Please select at least one pre-appointment time.");
            } else if (inputList[i].id == "interestProductCat") {
                alert("Please select at least one product of your interest.");
            } else {
                alert("Please fill in the required field : " + inputList[i].id);
            }
            return false;
        }
    }
    var selectCountry = document.getElementById("country");
    if (selectCountry.selectedIndex == 0) {
        alert("Please fill in the required field : " + selectCountry.id);
        return false;
    }
    return true;
}
//-->