function ShowHide(id) {

    var el = document.getElementById(id);

    if (el.style.display != 'none') {
        el.style.display = 'none';
    }
    else {
        el.style.display = 'block';
    }
}

function Subscribe() {

    if (document.getElementById('SubscribeForm').Email.value == 'E-mail address' || document.getElementById('SubscribeForm').Email.value == '') {

        alert('Please enter your e-mail address');

        return;

    }

    document.getElementById('SubscribeForm').submit();

}

function UploadImage() {

    var Images = 0;

    for (var i = 1; i <= 5; i++) {

        if (document.getElementsByName('ImageFile[' + i + ']')[0].value) {

            var Images = Images + 1;

            var extension = document.getElementsByName('ImageFile[' + i + ']')[0].value.split('.').pop().toLowerCase();

            if (extension != 'jpg' && extension != 'jpeg' && extension != 'png' && extension != 'gif') {

                alert('The file ' + i + ' is not a valid image file');

                return;

            }

        }

    }

    if (Images == 0) {

        alert('Chose at least one image to upload');

        return;

    }

    if (document.getElementById('UploadImageForm').ImageName.value == '') {

        alert('Please enter your name');

        return;

    }

    if (document.getElementById('UploadImageForm').ImageEmail.value == '') {

        alert('Please enter your e-mail address');

        return;

    }

    document.getElementById('UploadImageForm').style.display = 'none';

    document.getElementById('UploadImageProgress').style.display = 'block';

    document.getElementById('UploadImageForm').submit();

}


function PublishImage(PageId, ImageId) {

    Hidden.location = '/?_PageId=' + PageId + '&_ActionName=PublishImage&ImageId=' + ImageId;

}


function DeleteImage(PageId,ImageId){

    if (confirm('This deletes the image')) {

        Hidden.location = '/?_PageId=' + PageId + '&_ActionName=DeleteImage&ImageId=' + ImageId;

    }

}


function CreateVideo() {

    if (document.getElementById('CreateVideoForm').VideoYoutubeUrl.value == '') {

        alert('Please enter a link to your YouTube video');

        return;

    }

    if (document.getElementById('CreateVideoForm').VideoName.value == '') {

        alert('Please enter your name');

        return;

    }

    if (document.getElementById('CreateVideoForm').VideoEmail.value == '') {

        alert('Please enter your e-mail address');

        return;

    }

    document.getElementById('CreateVideoForm').style.display = 'none';

    document.getElementById('CreateVideoProgress').style.display = 'block';

    document.getElementById('CreateVideoForm').submit();

}


function PublishVideo(PageId, VideoId) {

    Hidden.location = '/?_PageId=' + PageId + '&_ActionName=PublishVideo&VideoId=' + VideoId;

}


function DeleteVideo(PageId, VideoId) {

    if (confirm('This deletes the video')) {

        Hidden.location = '/?_PageId=' + PageId + '&_ActionName=DeleteVideo&VideoId=' + VideoId;

    }

}


function CreateComment() {

    if (document.getElementById('CreateCommentForm').CommentText.value == '') {

        alert('Please enter a comment');

        return;

    }

    if (document.getElementById('CreateCommentForm').CommentName.value == '') {

        alert('Please enter your name');

        return;

    }

    if (document.getElementById('CreateCommentForm').CommentEmail.value == '') {

        alert('Please enter your e-mail address');

        return;

    }

    document.getElementById('CreateCommentForm').style.display = 'none';

    document.getElementById('CreateCommentProgress').style.display = 'block';

    document.getElementById('CreateCommentForm').submit();

}


function PublishComment(PageId, CommentId) {

    Hidden.location = '/?_PageId=' + PageId + '&_ActionName=PublishComment&CommentId=' + CommentId;

}


function DeleteComment(PageId, CommentId) {

    if (confirm('This deletes the comment')) {

        Hidden.location = '/?_PageId=' + PageId + '&_ActionName=DeleteComment&CommentId=' + CommentId;

    }

}



function CreateParticipant() {

    if (document.getElementById('CreateParticipantForm').ParticipantName.value == '') {

        alert('Please enter your name');

        return;

    }

    if (document.getElementById('CreateParticipantForm').ParticipantEmail.value == '') {

        alert('Please enter your e-mail address');

        return;

    }

    document.getElementById('CreateParticipantForm').style.display = 'none';

    document.getElementById('CreateParticipantProgress').style.display = 'block';

    document.getElementById('CreateParticipantForm').submit();

}


function DeleteParticipant(PageId, ParticipantId) {

    if (confirm('This deletes the participant')) {

        Hidden.location = '/?_PageId=' + PageId + '&_ActionName=DeleteParticipant&ParticipantId=' + ParticipantId;

    }

}


function UpdateParticipant(PageId, ParticipantId) {

    Hidden.location = '/?_PageId=' + PageId + '&_ActionName=PublishComment&CommentId=' + CommentId;

}



function CreateSendlist() {

    if (document.getElementById('CreateSendlistForm').Status1.checked != 1 && document.getElementById('CreateSendlistForm').Status2.checked != 1 && document.getElementById('CreateSendlistForm').Status3.checked != 1 && document.getElementById('CreateSendlistForm').Status4.checked != 1) {

        alert('Please check at least one status box');

        return;

    }

    if (document.getElementById('CreateSendlistForm').SendlistName.value == '') {

        alert('Please enter the sendlist name');

        return;

    }

    document.getElementById('CreateSendlistForm').submit();

}


function CreatePartner() {

    if (document.getElementById('CreatePartnerForm').PartnerName.value == '') {

        alert('Please enter the partners name');

        return;

    }

    if (document.getElementById('CreatePartnerForm').PartnerImageFile.value == '') {

        alert('Please select an image for the partner');

        return;

    }

    if (document.getElementById('CreatePartnerForm').PartnerUrl.value == '') {

        alert('Please enter the partners url');

        return;

    }

    document.getElementById('CreatePartnerForm').submit();

}

function DeletePartner(PageId, PartnerId) {

    if (confirm('This deletes the partner and moves all participants to the general group')) {

        Hidden.location = '/?_PageId=' + PageId + '&_ActionName=DeletePartner&PartnerId=' + PartnerId;

    }

}


function UpdateTab() {

    document.getElementById('edit-1').value = oEdit1.getHTMLBody();

    document.getElementById('UpdateTabForm').submit();

}