// Coinmach Concern form JS

// our validation function
function validate_core() {
    
    if (!(validateTextField('realname'))) return false
    if (!(validateTextField('Contact_Phone_Number'))) return false
    if (!(validateTextField('email'))) return false
    if (!(validateTextField('Lives_In'))) return false
    if (!(validateTextField('Room_Number'))) return false
    if (!(validateTextField('Date_of_Problem'))) return false
    if (!(validateTextField('recipient'))) return false
    if (!(validateTextField('Location'))) return false
    if (!(validateTextField('Machine_Number'))) return false
    return true;
}



function ToggleMachine(pType) {
    switch (pType.value) {
        case 'Washing Machine':
            ShowSection(document.getElementById('washerdryer'));
            ShowSection(document.getElementById('washer'));
            HideSection(document.getElementById('dryer'));
            HideSection(document.getElementById('changemachine'));
            break;
        case 'Drying Machine':
            ShowSection(document.getElementById('washerdryer'));
            HideSection(document.getElementById('washer'));
            ShowSection(document.getElementById('dryer'));
            HideSection(document.getElementById('changemachine'));
            break;
        case 'Coin Machine':
            HideSection(document.getElementById('washerdryer'));
            HideSection(document.getElementById('washer'));
            HideSection(document.getElementById('dryer'));
            ShowSection(document.getElementById('changemachine'));
            break;
    }
    

}

function ShowSection(vSection) {
    vSection.style.visibility = 'visible';
    vSection.style.display = 'block';
}

function HideSection(vSection) {
    vSection.style.visibility = 'hidden';
    vSection.style.display = 'none';
}

function InitPage() {
    ToggleMachine(document.getElementById('SelectService'));
}

function Text_Click(elem) {
    document.getElementById(elem).checked = true;
}

function Text_Change(box, prob, msg) {
    document.getElementById(prob).value = msg + box.value;
}

