function addimage(node) {

  //alert('addimage');
  newuploader = Builder.node('span', {id: 'uploader['+imageCounter+']'});
  newuploader.style.margin = '10px 5px';
  newuploader.innerHTML = "<input type='file' name='file[picture]["+imageCounter+"]' />";
  newuploader.innerHTML += "<a href='#' onclick='removeimage(this);'style='padding:5px'>Remove Picture</a>";
  newuploader.innerHTML += "<br/>"
//  newbreak = Builder.node('br');
//  newupload =  Builder.node('input', {type: 'file', name: 'file[picture]['+imageCounter+']', id: 'file[picture]['+imageCounter+']'});
  //newupload.innerHTML = 'Hi there';
  //newupload.style.border='2px solid #aaf';
//  newupload.style.margin='10px';
  
  /*    highlighter.style.border = "2px solid #99f";
        highlighter.style.position ="absolute";
          highlighter.style.top = '0';
            highlighter.style.left = '0';
              highlighter.style.background = '#fff';
                highlighter.style.padding = '15px';
    */
// removelink = Builder.node('a', {onclick='removeuploader(this);'});            
 $(node).appendChild(newuploader);
// $(node).appendChild(newbreak);
// alert(newuploader.outerHTML);
// alert(newuploader.innerHTML);                 
 imageCounter++;

}

imageCounter = 1;

function removeimage(node) {

//alert(node);
  //host= $('moreimages');
  //container = $(node).parentNode;
  //container = $(container);
  //container.removeChild(node);
  pn = node.parentNode.parentNode;
//  alert(node.parentNode.parentNode);
  pn.removeChild(node.parentNode);
  //mr = $('moreimages');
  //mr.removeChild(node);

}

function ajax_add_image(id) {
	new Ajax.Updater("image_thumbs", "/image/ajax_refresh/" + id, 
//                        {insertion:Insertion.Bottom, evalScripts:true, asynchronous:true});	
                        { evalScripts:true, asynchronous:true});	
	//alert("/image/ajax_get_image/" + id);

	Effect.SlideUp('add_image_form');
}


function togglePages(albumid) {

  albumid = $(albumid);

}



