function ResetPage() {
    setTimeout("document.location=document.location", 1500);
}

function ReturnPage() {
    setTimeout("document.location=document.referrer", 1500);
}

function AddAgenda(p_intId) {
    SendRequest('/Ajax/Agenda/AgendaVoegtoe.aspx', 'rId=' + p_intId);
}

function SaveAgenda(p_intId) {
    DHTMLAreaToTextArea();
    var l_blnError = false;
    
    if(document.getElementById ('AgendaTitel').value == '') {
        alert ('De titel is verplicht!');
        document.getElementById ('AgendaTitel').focus();
        l_blnError = true;
    }

    if (
        document.getElementById ('AgendaDag').value != '' && 
        document.getElementById ('AgendaMaand').value != '' &&
        document.getElementById ('AgendaJaar').value != ''
        ) {
        if (!isDate (document.getElementById ('AgendaDag').value + '/' + document.getElementById ('AgendaMaand').value + '/' + document.getElementById ('AgendaJaar').value)) {
            alert ('De door u ingevulde datum is niet in het correcte formaat, of de datum is niet geldig.\n\nHet juiste formaat is dd/mm/jjjj.');
            document.getElementById ('AgendaDag').focus();
            l_blnError = true;
        }
    }
    if(!l_blnError) {
        SendRequestFunction('/Ajax/Agenda/AgendaVoegtoe.aspx', GetAllValues('FormAgendaUpload') + '&rId=' + p_intId, ReturnPage);
    }
}

function EditAgenda(p_intId) {
    SendRequest('/Ajax/Agenda/AgendaEdit.aspx', 'rId=' + p_intId);
}


function SaveEditAgenda(p_intId) {
    DHTMLAreaToTextArea();
    var l_blnError = false;
    
    if(document.getElementById ('AgendaTitel').value == '') {
        alert ('De titel is verplicht!');
        document.getElementById ('AgendaTitel').focus();
        l_blnError = true;
    }

    if (
        document.getElementById ('AgendaDag').value != '' && 
        document.getElementById ('AgendaMaand').value != '' &&
        document.getElementById ('AgendaJaar').value != ''
        ) {
        if (!isDate (document.getElementById ('AgendaDag').value + '/' + document.getElementById ('AgendaMaand').value + '/' + document.getElementById ('AgendaJaar').value)) {
            alert ('De door u ingevulde datum is niet in het correcte formaat, of de datum is niet geldig.\n\nHet juiste formaat is dd/mm/jjjj.');
            document.getElementById ('AgendaDag').focus();
            l_blnError = true;
        }
    }
    if(!l_blnError) {
        SendRequestFunction('/Ajax/Agenda/AgendaEdit.aspx', GetAllValues('FormAgendaUpload') + '&rId=' + p_intId, ResetPage);
    }
}