function ResetPage() {
    setTimeout("document.location=document.location", 1500);
}

function UploadVideo() {
    SendRequest('/Ajax/Video/VideoVoegtoe.aspx');
}


function SaveVideo() {
    var l_blnError = false;
    
    if(document.getElementById('VideoTitel').value == '') {
        alert ('De titel is verplicht!');
        document.getElementById ('VideoTitel').focus();
        l_blnError = true;
    }
    
    if(!(document.getElementById('VideoLink').value.indexOf("http://www.youtube.com/") > -1)) {
        alert ('Video moet vanaf YouTube komen!');
        document.getElementById ('VideoLink').focus();
        l_blnError = true;
    }
    
    if(!l_blnError) {
        SendRequestFunction('/Ajax/Video/VideoVoegtoe.aspx', GetAllValues('FormVideoUpload'), ResetPage);
    }
}


function EditVideo(p_strId) {
    SendRequest('/Ajax/Video/VideoEdit.aspx', 'rId=' + p_strId);
}


function SaveEditVideo(p_strId) {

    if(document.getElementById('VideoDelete').checked) {
        SendRequestFunction('/Ajax/Video/VideoEdit.aspx', GetAllValues('FormVideoUpload') + '&rId=' + p_strId, ResetPage);
    } else {
        var l_blnError = false;
        
        if(document.getElementById('VideoTitel').value == '') {
            alert ('De titel is verplicht!');
            document.getElementById ('VideoTitel').focus();
            l_blnError = true;
        }
        if(!(document.getElementById('VideoLink').value.indexOf("http://www.youtube.com/") > -1)) {
            alert ('Video moet vanaf YouTube komen!');
            document.getElementById ('VideoLink').focus();
            l_blnError = true;
        }
        
        if(!l_blnError) {
            SendRequestFunction('/Ajax/Video/VideoEdit.aspx', GetAllValues('FormVideoUpload') + '&rId=' + p_strId, ResetPage);
        }
    }
}


function UploadGroepVideo(p_intId) {
    SendRequest('/Ajax/Video/VideoGroepVoegtoe.aspx', 'GroepId=' + p_intId);
}


function SaveGroepVideo(p_intId) {
    var l_blnError = false;
    if(document.getElementById('VideoTitel').value == '') {
        alert ('De titel is verplicht!');
        document.getElementById ('VideoTitel').focus();
        l_blnError = true;
    }
    if(!(document.getElementById('VideoLink').value.indexOf("http://www.youtube.com/") > -1)) {
        alert ('Video moet vanaf YouTube komen!');
        document.getElementById ('VideoLink').focus();
        l_blnError = true;
    }
    
    if(!l_blnError) {
        SendRequestFunction('/Ajax/Video/VideoGroepVoegtoe.aspx', GetAllValues('FormVideoUpload') + '&GroepId=' + p_intId, ResetPage);
    }
}


function EditGroepVideo(p_strId) {
    SendRequest('/Ajax/Video/VideoGroepEdit.aspx', 'rId=' + p_strId);
}

function SaveEditGroepVideo(p_strId) {
    var l_blnError = false;
    if(document.getElementById('VideoTitel').value == '') {
        alert ('De titel is verplicht!');
        document.getElementById ('VideoTitel').focus();
        l_blnError = true;
    }
    if(!(document.getElementById('VideoLink').value.indexOf("http://www.youtube.com/") > -1)) {
        alert ('Video moet vanaf YouTube komen!');
        document.getElementById ('VideoLink').focus();
        l_blnError = true;
    }
    
    if(!l_blnError) {
        SendRequestFunction('/Ajax/Video/VideoGroepEdit.aspx', GetAllValues('FormVideoUpload') + '&rId=' + p_strId, ResetPage);
    }
}
