/*
This script is copyright (c) 2006 Elliot Swan under the
Creative Commons Attribution-ShareAlike 2.5 license:
http://creativecommons.org/licenses/by-sa/2.5/

More information on this script can be found at:
http://www.elliotswan.com/2006/04/12/move-and-copy/

Modified 2008, Zachary Wilson - zak.wilson@gmail.com
*/


var Move =	{

    copy	:   function(e, target, append)	{
	var eId      = $(e);
	var copyE    = eId.cloneNode(true);
	var cLength  = copyE.childNodes.length -1;
	copyE.id     = e+append;
	
	for(var i = 0; cLength >= i;  i++)	{
	    if(copyE.childNodes[i].id) {
		var cNode   = copyE.childNodes[i];
		var firstId = cNode.id;
		cNode.id    = firstId+'-copy'; }
	}
	$(target).appendChild(copyE);
	return copyE;
    },
    element:  function(e, target, type, append)	{
	var eId =  $(e);
	if(type == 'move') {
	    $(target).appendChild(eId);
	}
	
	else if(type == 'copy')	{
	    return this.copy(e, target, append);
	}
    }
}