var _id = document.getElementsByTagName('li').length;
function addImage(src, alt_text, id) {
    var li = document.createElement('li');
    var img = document.createElement('img');
    img.alt = alt_text;
    img.src = src;
    img.className = 'thumb';
    var img2 = document.createElement('img');
    _id++;
    img2.id = 'rem_' + _id;
    img2.alt = 'remove';
    img2.height = 15; img2.width = 15;
    img2.src = '/images/remove.gif';
    img2.onclick = function(){removeParent(img2)};
    img2.title = 'remove';
    var input = document.createElement('input');
    input.type = 'hidden';
    input.name = 'images[]';
    input.value = id;
    li.appendChild(img);
    li.appendChild(img2);
    li.appendChild(input);
    document.getElementById('images').appendChild(li);
    return false;
}
function removeParent(obj)
{
    var x = document.getElementById('images');
    x.removeChild(obj.parentNode);
}
