Hi guys,

I've been working on a project now for a while using the script.aculo.us library.

The base of it is a main DIV that holds various other DIV. The divs that are added into main one are draggable and constrained to the parent div.

To do this I have made an object, that can be initialized and then it sets up the drag and drop etc from itself.

However, there is a strange problem when I add the first table its fine. However, if i add two the first dragging ability stops working. If i add a third the second stops working also and so on.

I think that it must be overwriting something... but I'm not sure where or what. I get confused a bit by the prototype OO style in JavaScript. The following is the method from the object controlling the div. I'm not sure what other code needs to be shown, let me know if there is anything else.

Thanks again in advance, I'm getting pretty desperate with this as I need to get it going very soon.

Code:
	makeDraggable: function(){
		
		qb.log.add("Adding Drag: " + this.divId +"(" +  this.name + ")");
		
		this.dragId = new Draggable(this.divId,{
			snap: function(x,y,draggable) {
	  			function constrain(n, lower, upper) {
					if (n > upper) return upper;
					else if (n < lower) return lower;
					else return n;
	  			}
	  			element_dimensions = Element.getDimensions(draggable.element);
	  			parent_dimensions = Element.getDimensions(draggable.element.parentNode);;
	  			return[
				constrain(x, 11, parent_dimensions.width - element_dimensions.width + 9),
				constrain(y, 11, parent_dimensions.height - element_dimensions.height + 9)];
			},
			
			scroll:window,
	  		handle: this.handId,
			zindex:9
	  	});
		
	}