var Alert_StopAction = "Please select Stop Action";
var Alert_Symbol = "Please select Symbol";
var Alert_LandmarkOrAddress = "Please select Landmark or give street address";
var Alert_Landmark = "Please select Landmark";
var Alert_GarminAction = "Please select Garmin Action";
var Alert_GarminMessage = "Please enter a message";
function ValidateGarminMaster() {
    var command = document.getElementById('ddlCommands').value;
    var StopAction = document.getElementById('ddlSymbol');
    var Symbol = document.getElementById('ddlStopGarminAction');
    var Landmark = document.getElementById('ddlLandmarks');
    var address = document.getElementById('txtAddress');
    var GarminAction = document.getElementById('ddlStopGarminAction');
    var GarminMessage = document.getElementById('txtGarminMessage');
    var message = '';
    if (command == "-1") {
        message += "Please select a command";
    }
    else if (command == '&') {
        if (GarminMessage != null && GarminMessage.value.length == 0) {
            message += Alert_GarminMessage + "\n";
            document.getElementById('txtGarminMessage').focus();
        }
    }
    else if (command == 'W3') {
        if (address.value.length == 0 && (document.getElementById('ddlLandmarks').value.length == 0 || document.getElementById('ddlLandmarks').value == "-1")) {
            message += Alert_LandmarkOrAddress + "\n";
            document.getElementById('ddlLandmarks').focus();
        }
        if (document.getElementById('ddlSymbol').value == "-1") {
            message += Alert_Symbol + "\n";
            document.getElementById('ddlSymbol').focus();
        }

    }
    else if (command == 'W4') {
        if (document.getElementById("rdbDeleteAll").checked == false) {
            if (address.value.length == 0 && document.getElementById('ddlLandmarks').value == "-1") {
                message += Alert_LandmarkOrAddress + "\n";
                document.getElementById('ddlLandmarks').focus();
            }
        }
    }
    else if (command == 'W5' || command == 'W6') {
        if (command == 'W5' && document.getElementById('ddlLandmarks').value == "-1") {
            message += Alert_Landmark + "\n";
            document.getElementById('ddlLandmarks').focus();
        }
        if (document.getElementById('ddlStopGarminAction').value == "-1") {
            message += Alert_StopAction + "\n";
            document.getElementById('ddlStopGarminAction').focus();
        }
    }
    else if (command == 'W29') {
    if (document.getElementById('ddlRouteName').value == "-1" && document.getElementById('ddlRouteName').value == "0") {
        message += "Please choose the Route to assign" + "\n";
        document.getElementById('ddlRouteName').focus();
    }
    }
    if (message.length != 0) {
        alert(message);
        return false;
    } else { ShowPopUp(); }
}
function SetExportHiddenValue() {
    document.getElementById("hdnExport").value = "1";
}
function ClearValue() {
    if (document.getElementById("rdbAdd") != null) {
        if (document.getElementById("rdbAdd").checked)
            document.getElementById("rdbAdd").disabled = true;
        else
            document.getElementById("rdbAdd").disabled = false;
    }
    if (document.getElementById("rdbDelete") != null) {
        if (document.getElementById("rdbDelete").checked)
            document.getElementById("rdbDelete").disabled = true;
        else
            document.getElementById("rdbDelete").disabled = false;
    }
    if (document.getElementById("rdbDeleteAll") != null) {
        if (document.getElementById("rdbDeleteAll").checked)
            document.getElementById("rdbDeleteAll").disabled = true;
        else
            document.getElementById("rdbDeleteAll").disabled = false;
    }
}