root = "http://www.55thscouts.com/";

function show_element( el, display ) {
    el = document.getElementById( el );
    el.style.display = display;
}

function show_album_list() {
    el = document.getElementById('album-list');
    el.style.display = 'inline';
}

function edit_album( album ) {
    window.location = root + '?page=leaders&act=album&id=' + album;
}

function edit_image( image, title, description ) {
    el = document.getElementById('edit-image-div');
    el.style.display = 'inline';

    title = title.replace(/\/quot/g,'&quot;');
    title = title.replace(/\/39/g,'&#39;');
    description = description.replace(/\/quot/g,'&quot;');
    description = description.replace(/\/39/g,'&#39;');

    el.innerHTML = '\
        <a name="edit-image"></a><h3>Edit Image</h3>\
        <form action="" method="post">\
        <input type="hidden" name="form-type" value="edit-image" />\
        <input type="hidden" name="iid" value="' + image + '" />\
        <table class="show-table" style="border:0;">\
        <tr><td><label for="title">Title:</label></td><td><input type="text" id="title" name="title" value="' + title + '"></td></tr>\
        <tr><td><label for="description">Description:</label></td><td><textarea id="description" name="description" style="width:100%">' + description + '</textarea></td></tr>\
        <tr><td></td><td><input type="submit" value="Save changes" onclick="this.disabled=true;" class="button" /></td></tr>\
        </table>\
        </form>\
    ';
}

function delete_image( image, album ) {
    if(album) {
        if(confirm('Are you sure you want to permanently delete this entire album?')) {
            window.location = root + '?page=leaders&act=delete&album=' + album;
        }
    } else {
        if(confirm('Are you sure you want to permanently delete this image?')) {
            window.location = root + '?page=leaders&act=delete&id=' + image;
        }
    }
}

function delete_item( type, id ) {
    if(type==2) {
        if(confirm('Are you sure you want to delete this user?')) {
            window.location = root + '?page=leaders&act=delete&user=' + id;
        }
    }
}