﻿function Validate() {

    if (document.getElementById("TextBox1").value == "") {
        ShowMessage("Your Surname is required", true);
        return false;
    }
    if (document.getElementById("TextBox2").value == "") {
        ShowMessage("Your Name is required", true);
        return false;
    }
    if (document.getElementById("TextBox4").value == "") {
        ShowMessage("Your Cell / Mobile Phone is required", true);
        return false;
    }
    if (document.getElementById("TextBox5").value == "") {
        ShowMessage("Your Date of Birth is required", true);
        return false;
    }
    if (document.getElementById("TextBox7").value == "") {
        ShowMessage("Your Contact person name is required", true);
        return false;
    }
    if (document.getElementById("TextBox8").value == "") {
        ShowMessage("Your Contact Person's Phone is required", true);
        return false;
    }
        
    if (document.getElementById("TextBox18").value == "") {
        ShowMessage("Your Email is required", true);
        return false;
    }
    if (IsEmail(document.getElementById("TextBox18")) == "error") {
        ShowMessage("Invalid Email", true);
        return false;
    }
    

    return true;

}

function GetOption() {
    var SelectedVal = GetDropDownListValue();
    switch (SelectedVal) {
        case "1":
            $get("SummerDiv").style.display = "block";
            $get("SubOptionsDiv").style.display = "none";
            $get("InstructionsDiv").innerHTML = "Additional instructions will be sent to you, enabling to continue the registration.";
            break;
        case "2":
            $get("SummerDiv").style.display = "none";
            $get("SubOptionsDiv").style.display = "none";
            $get("InstructionsDiv").innerHTML = "Additional instructions will be sent to you, enabling to continue the registration.";
            break;
        case "3":
            $get("SummerDiv").style.display = "none";
            $get("SubOptionsDiv").style.display = "none";
            $get("InstructionsDiv").innerHTML = "Additional instructions will be sent to you, enabling to continue the registration.";
            break;
        case "4":
            $get("SummerDiv").style.display = "none";
            $get("SubOptionsDiv").style.display = "none";
            $get("InstructionsDiv").innerHTML = "Additional instructions will be sent to you, enabling to continue the registration.";
            break;
        case "1000":
            $get("SummerDiv").style.display = "none";
            $get("SubOptionsDiv").style.display = "block";
            $get("InstructionsDiv").innerHTML = "Additional instructions will be sent to you, enabling to continue the registration.";
            break;
    }
}

function GetDropDownListValue() {
    var SelectedVal = "";
    var list = document.getElementsByName("OptionsDropDownList");

    for (var i = 0; i < list.length; ++i) {

        if (list[i].checked) {
            SelectedVal = list[i].value;
        }
    }
    
    return SelectedVal;
}

