(function(){

/*
	Class: BoxItem
	*Subclass of <BarItem>*

	Description:
	The classic popped up view focused on a singe item
*/
function BoxItem()
{
	this.p_item = null;
	
	SBui.BoxItem.superclass.constructor.call(this);

	this.view_type = 1;
	this.containerView = null;
	this.tooltip = window['SB']['ui']['Tooltip'];
}

//BoxItem extends BarItem.  
YAHOO.lang.extend( BoxItem, window['SB']['ui']['BarItem']);


BoxItem.prototype.toString = function() { return "[SB.ui.BoxItem]"; };

/*
*	Function: setConfig
*	Establishes the basic setup for the BarItem.
*	
*	inConfig - A configuration array (key/value)
*
*	Configuration Array Options:
*	id - the id of the div to use as a template (default: sb_ui_baritem)
*/
BoxItem.prototype.setConfig =  function( inConfig )
{
	//Make sure to zero this out, we shouldn't directly set an action
	inConfig.action = null;
	
	this.box_obj = inConfig.box_obj;
	SBui.BoxItem.superclass.setConfig.call(this, inConfig);

	this.view_type = this.box_obj.view_type;

	if( inConfig.is_public )
		this.is_public = inConfig.is_public;
	else
		this.is_public = false;


	if( this.box_obj.name )
	{
		var boxName = this.box_obj.name; 

		YUIDom.getElementsByClassName( "sb_box_name", "div", this.htmlObj,
		function( el ) { 
			el.innerHTML = boxName; 
		});
	}

	if( this.box_obj.shared == "1" )
	{
		YUIDom.getElementsByClassName( "sb_box_shared_tag", "div", this.htmlObj,
		function( el ) { 
			el.style.display = "block"; 
		});
	}

	if( this.box_obj.public == "1" )
	{
		YUIDom.getElementsByClassName( "sb_box_public_tag", "div", this.htmlObj,
		function( el ) { el.style.display = "block"; });
	}

	if( this.box_obj.paired )
	{
		YUIDom.getElementsByClassName( "sb_box_paired_tag", "div", this.htmlObj,
		function( el ) { el.style.display = "block"; });
	}

	var arr = YUIDom.getElementsByClassName( "boxitem", "div", this.htmlObj );
	if( arr[0] ) 
	{ 
		this.boxitem = arr[0];
		this.dd = new BoxItemDD( arr[0], this );	
		YUIEvent.addListener( arr[0], "click", this.loadItems, this, true );
	}

	this.bar = inConfig.bar;

	//SButil.EventManager.addListener("SEBoxUpdate", onSEBoxUpdate, this);
	SButil.EventManager.addListener("BoxItemDeactivated", onBoxItemDeactivated, this);
	SButil.EventManager.addListener("BoxDeleted", onBoxDeleted, this);
	SButil.EventManager.addListener("BoxSharingChanged", onBoxSharingChanged, this);
};

/*
*	Function rename 
*	Updates the name of the box 
*/
BoxItem.prototype.rename = function( inName )
{
	this.name = inName;
	this.box_obj.name = inName;

	var arr = YUIDom.getElementsByClassName( "sb_box_name", "div", this.htmlObj );
	for(var i = 0; i < arr.length; i++) arr[i].innerHTML = inName;
};

/*
*	Function reorder 
*	Updates the order of the box 
*/
BoxItem.prototype.reorder = function( inPos )
{
};


BoxItem.prototype.attach = function()
{
	if( this.name )
	{
		var boxName = this.name.truncate( this.getWidth() + 25, this.getHeight(), true );  

		var fullName = this.name;
		var elm = this.htmlObj;

		var details = "<p style='margin: 5px; margin-top: 0px; font-size: 13px;'>";

		if( this.box_obj.shared == "1" )
			details += "<span>&nbsp;&nbsp;<img src='http://"+window["sb_static_image_host"]+"/images/icon_shared.gif' width='14' height='14' align='bottom' />&nbsp;"+SBtranslation[24]+"</span><br />";

		if( this.box_obj.public =="1" )
			details += "<span>&nbsp;&nbsp;<img src='http://"+window["sb_static_image_host"]+"/images/icon_public.gif' width='14' height='14' align='bottom' />&nbsp;"+SBtranslation[26]+"</span><br />";
		
		if( this.box_obj.paired )
		{
			details += "<span><img src='http://"+window["sb_static_image_host"]+"/images/icon_paired.gif' width='21' height='14' align='bottom' />&nbsp;"+SBtranslation[27]+": ";
			var services = [];
			var i = 0;
			if( this.box_obj.twitter ) services[i++] = "Twitter";
			if( this.box_obj.delicious) services[i++] = "Delicious";
			if( this.box_obj.tumblr) services[i++] = "Tumblr";
			if( this.box_obj.diigo) services[i++] = "Diigo";
			details += services.join(", ");

			details += "</span>";
		}
		details += "</p>";

		elm.tooltipText = "<span style='font-weight: bold;'>"+fullName+"</span>"+details;
	
		YUIEvent.addListener( this.htmlObj, "mouseover", 
			function( ev ) { SBui.Tooltip.show( ev, elm );  } );
		YUIEvent.addListener( this.htmlObj, "mouseout", 
			function( ev ) { SBui.Tooltip.hide() } );

		YUIDom.getElementsByClassName( "sb_box_name", "div", this.htmlObj,
			function( el ) { el.innerHTML = boxName; });
	
	}
};

BoxItem.prototype.rename = function( newName )
{
	this.name = newName;

	var boxName = this.name.truncate( this.getWidth() + 25, this.getHeight(), true );  
	var fullName = this.name;
	var elm = this.htmlObj;
	elm.tooltipText = fullName;

	YUIDom.getElementsByClassName( "sb_box_name", "div", this.htmlObj,
		function( el ) { el.innerHTML = boxName; });
	
	param = {box:this};
	SButil.EventManager.fireEvent( "BoxUpdated", param );
};

function loadItemsCallback( inReq )
{
	var resp = YUIJSON.parse( inReq.responseText );
	var itemList = resp.items;

	if( !itemList.status )
	{

		var box = this.arguments.obj;
		box.total_items = resp.total_items;

		if( box.offset == 0 )
			box.box_obj.item_list.removeAll();

		var i = 0;
		for( ; i < itemList.length; i++ )
		{
			var item = new SBCore.Item();
			item.setConfig( itemList[i] );
			box.box_obj.addItem( item );
		}	
	}

	//Make this BoxItem Active
	if( box.offset == 0 ) box.setActive( true );

	SButil.EventManager.fireEvent( "BoxItemsLoaded", { box:box, offset:box.offset } );
}

function loadSharedCallback( inReq )
{
	var resp = YUIJSON.parse( inReq.responseText );
	var shareList = resp;

	var box = this.arguments.obj;

	box.box_obj.num_shared = (shareList.sbusers.length + shareList.public_users.length );

	if( box.box_obj.num_shared > 0 && box.box_obj.shared != "1" )
	{
		box.box_obj.shared = "1"; 
		YUIDom.getElementsByClassName( "sb_box_shared_tag", "div", box.htmlObj,
		function( el ) { el.style.display = "block"; });

		YUIRequest.asyncRequest("POST","/box/correctsharing",null, "id="+box.box_obj.id+"&share=1");
	}
	else if ( box.box_obj.num_shared == 0 && box.box_obj.shared == "1" )
	{
		box.box_obj.shared = "0"; 
		YUIDom.getElementsByClassName( "sb_box_shared_tag", "div", box.htmlObj,
		function( el ) { el.style.display = "none"; });
		YUIRequest.asyncRequest("POST","/box/correctsharing",null, "id="+box.box_obj.id+"&share=0");
	}




	var i = 0;
	for( ; i < shareList.sbusers.length; i++ )
		box.box_obj.share_list.append( { name:shareList.sbusers[i], sbuser:1} );

	for( i = 0 ; i < shareList.public_users.length; i++ )
		box.box_obj.share_list.append( { name:shareList.public_users[i], sbuser:0} );

	SButil.EventManager.fireEvent( "BoxSharedListLoaded", { box:box, offset:box.offset } );
}


/*
	Function: getX
	Returns the dynamic horizontal position for the DOMElement
*/
BoxItem.prototype.getX = function()
{
	return this.htmlObj.offsetLeft;
};



/*
	Function: loadItems
	Refreshes the <Stage> with the contents of the box 
*/
BoxItem.prototype.loadItems = function()
{
	//Make this BoxItem Active
	this.setActive( true );
	SButil.EventManager.fireEvent( "BoxItemActivated", this );
	SButil.EventManager.addListener("BoxItemActivated", onActivationChanged, this );

	if( 1 || this.box_obj.item_list.size() == 0 )
	{
		this.offset = 0;
		var url = "/item/getbybox/?box_id="+this.box_obj.box_id;
		url += "&start=0&results=10";
		url += "&rnd="+Math.random();
		YUIRequest.asyncRequest( "GET", url, { success:loadItemsCallback, arguments:{ obj:this } } );
	}
	else
	{
		SButil.EventManager.fireEvent( "BoxItemsLoaded", { box:this, offset:0 } );
	}

	if( !this.is_public )
	{
		if( 1 || this.box_obj.share_list.size() == 0 )
		{
			this.box_obj.share_list.removeAll();

			var url = "/crate/getshared/?id="+this.box_obj.box_id;
			YUIRequest.asyncRequest( "GET", url, { success:loadSharedCallback, arguments:{ obj:this } } );

		}
		else
		{
			SButil.EventManager.fireEvent( "BoxSharedListLoaded", { box:this } );
		}
	}
};

/*
	Function: loadExistingItems
	Refreshes the <Stage> with the contents of the box 
*/
BoxItem.prototype.loadExistingItems = function( itemList )
{
	SButil.EventManager.fireEvent( "BoxItemActivated", this );

	this.total_items = itemList.total_items;

	this.offset = 0;

	this.box_obj.item_list.removeAll();

	var i = 0;
	for( ; i < itemList.items.length; i++ )
	{
		var item = new SBCore.Item();
		item.setConfig( itemList.items[i] );
		this.box_obj.addItem( item );
	}	

	//Make this BoxItem Active
	this.setActive( true );

	SButil.EventManager.fireEvent( "BoxItemsLoaded", { box:this, offset:this.offset } );
};


/*
	Function: loadMoreItems
	Adds more Items to the <Stage> with the contents of the box 
*/
BoxItem.prototype.loadMoreItems = function()
{
	if( this.is_active )
	{
		this.offset += 10;	
		var url = "/item/getbybox/?box_id="+this.box_obj.box_id;
		url += "&start="+this.offset+"&results=10";
		YUIRequest.asyncRequest( "GET", url, { success:loadItemsCallback, arguments:{ obj:this } } );
	}
};

/*
	Function: loadAllItems
	Adds more Items to the <Stage> with the contents of the box 
*/
BoxItem.prototype.loadAllItems = function()
{
	if( this.is_active )
	{
		this.offset += 10;	
		var url = "/item/getbybox/?box_id="+this.box_obj.box_id;
		url += "&start="+this.offset+"&results=10000";
		YUIRequest.asyncRequest( "GET", url, { success:loadItemsCallback, arguments:{ obj:this } } );
	}
};

/*
	Function: acceptsDrop
	Standard entry point to check if a drag/drop operation on this object would be valid.

	NOTE: This should be part of some kind of dragndrop interface

	Returns - Boolean ( true if BoxItem will accept a drop from the obj )
*/
BoxItem.prototype.acceptsDrop = function( inObj )
{
	if( !inObj ) return false;

	if( inObj.toString() === "[SB.ui.ListViewItem]" ) 
	{
		if( inObj.item_obj.box_id != this.box_obj.id )
		return true;
	}

	if( inObj.toString() === "[SB.ui.FreeViewItem]" ) 
	{
		if( inObj.item_obj.box_id != this.box_obj.id )
		return true;
	}

	if( inObj.toString() === "[SB.ui.GridViewItem]" ) 
	{
		if( inObj.item_obj.box_id != this.box_obj.id )
		return true;
	}

	return false;
};

/*
	Function: handleDrop
	Process Drop action	

	NOTE: This should be part of some kind of dragndrop interface
*/
BoxItem.prototype.handleDrop = function( e, inObj )
{
	if( this.acceptsDrop( inObj ) ) 
	{
		inObj.move( this );
	}

	if( this.arrow )
	{
		document.body.removeChild( this.arrow );
		this.arrow = null;
	}
};

/*
	Function: move
	Assigns the box to a different container

	toContainer - destination container
*/
BoxItem.prototype.move = function( toContainer ) 
{
	if( this.container != toContainer )
	{
		var req = "/box/move/";
		var pd = "id="+this.box_obj.box_id+"&container_id="+toContainer.container_obj.container_id;
		var cb = { success:moveBoxSuccess, 
			 arguments:{ container:toContainer, 
					  box:this, 
				old_container:this.box_obj.container} };

		YUIRequest.asyncRequest( "POST", req, cb, pd );
	}
};

function moveBoxSuccess( inObj )
{
	var box = this.arguments.box;
	var container = this.arguments.container;
	var old_container = this.arguments.old_container;

	box.box_obj.move( container.container_obj );
	container.bar.boxbar.removeItem( box ); 			

	box.container = container;

	YUIDom.setStyle( box.boxitem, "visibility", "visible" );

	container.addBoxItem( box );

	var ctx = { box:box, from:old_container, to:container };
	SButil.EventManager.fireEvent( "BoxMoved", ctx );
} 


/*
	Function: handleDragEnter
	Process DragEnter action	

	NOTE: This should be part of some kind of dragndrop interface
*/
BoxItem.prototype.handleDragEnter = function( e, inObj )
{
	var reg = YAHOO.util.Region.getRegion( this.htmlObj );
	var rarrow = YUIDom.get("sb_ui_box_drop_indicator");
	this.arrow = null;
	this.arrow = rarrow.cloneNode( true );
	this.arrow.style.left = (reg.left + 25) + "px";
	this.arrow.style.top = (reg.top - 70) + "px";

	document.body.appendChild( this.arrow );
	YUIEvent.stopEvent( e );

	return true;
};

/*
	Function: handleDragOut
	Process DragOut action	

	NOTE: This should be part of some kind of dragndrop interface
*/
BoxItem.prototype.handleDragOut = function( e, inObj )
{
	if( this.arrow )
	{
		document.body.removeChild( this.arrow );
		this.arrow = null;
	}
};

/*
	Function: activate
	Called externally to set the Box as active (also sets a listener for activation changes) 
	broadcast - should the activation broadcast an event (default true)
*/
BoxItem.prototype.activate = function( broadcast ) 
{
	this.setActive( true );

	if( broadcast === true || broadcast == "undefined" )
		SButil.EventManager.fireEvent( "BoxItemActivated", this );

	SButil.EventManager.addListener("BoxItemActivated", onActivationChanged, this );
};

/*
*	Function trash 
*	Calls the underlying box core object which calls to the server to delete
*/
BoxItem.prototype.trash = function()
{
	if( window["dlgManager"] )
		window["dlgManager"].showDeleteBoxDialog( this );
};


/*
	Function: onBoxDeleted
	Callback for when a box is removed.  We need to check to see if it was us.
*/
function onBoxDeleted(inEvent, inArgs )
{
	if( this.box_obj.id == inArgs[0].box.box_obj.id ) 
	{
		this.box_obj.trash();
		this.bar.removeItem( this );	
	}		
}

function onBoxSharingChanged(inEvent, inArgs)
{
	if( this.box_obj.id == inArgs[0].box.id ) 
	{
		if( this.box_obj.num_shared <= 0 )
		{
			YUIDom.getElementsByClassName( "sb_box_shared_tag", "div", this.htmlObj,
			function( el ) { el.style.display = "none"; });
		}
		else
		{
			YUIDom.getElementsByClassName( "sb_box_shared_tag", "div", this.htmlObj,
			function( el ) { el.style.display = "block"; });

		}

		if( this.box_obj.public == "1" )
		{
			YUIDom.getElementsByClassName( "sb_box_public_tag", "div", this.htmlObj,
			function( el ) { el.style.display = "block"; });
		}
		else
		{
			YUIDom.getElementsByClassName( "sb_box_public_tag", "div", this.htmlObj,
			function( el ) { el.style.display = "none"; });
		}

		if( this.box_obj.twitter || this.box_obj.tumblr || this.box_obj.delicious || this.box_obj.diigo )
		{
			this.box_obj.paired = true;
			YUIDom.getElementsByClassName( "sb_box_paired_tag", "div", this.htmlObj,
			function( el ) { el.style.display = "block"; });
		}
		else
		{
			this.box_obj.paired = false;
			YUIDom.getElementsByClassName( "sb_box_paired_tag", "div", this.htmlObj,
			function( el ) { el.style.display = "none"; });
		}

		var fullName = this.name;
		var elm = this.htmlObj;

		var details = "<p style='margin: 5px; margin-top: 0px; font-size: 13px;'>";

		if( this.box_obj.shared == "1" )
			details += "<span>&nbsp;&nbsp;<img src='http://"+window["sb_static_image_host"]+"/images/icon_shared.gif' width='14' height='14' align='bottom' />&nbsp;"+SBtranslation[24]+"</span><br />";

		if( this.box_obj.public =="1" )
			details += "<span>&nbsp;&nbsp;<img src='http://"+window["sb_static_image_host"]+"/images/icon_public.gif' width='14' height='14' align='bottom' />&nbsp;"+SBtranslation[26]+"</span><br />";
		
		if( this.box_obj.paired )
		{
			details += "<span><img src='http://"+window["sb_static_image_host"]+"/images/icon_paired.gif' width='21' height='14' align='bottom' />&nbsp;"+SBtranslation[27]+": ";
			var services = [];
			var i = 0;
			if( this.box_obj.twitter ) services[i++] = "Twitter";
			if( this.box_obj.delicious) services[i++] = "Delicious";
			if( this.box_obj.tumblr) services[i++] = "Tumblr";
			if( this.box_obj.diigo) services[i++] = "Diigo";

			details += services.join(", ");

			details += "</span>";
		}
		details += "</p>";

		elm.tooltipText = "<span style='font-weight: bold;'>"+fullName+"</span>"+details;

	}
}

/*
	Function: onBoxUpdate
	Callback for when a box update is received via a server event
*/
function onSEBoxUpdate(inEvent, inArgs )
{
	var box = inArgs[0];
	
	if( box.id == this.box_obj.id && box.modstatus != 2 )
	{
		if( box.name != this.name )
			this.rename( box.name );	

		//if( box.pos != this.box_obj.pos )
			//this.reorder( box.pos );	
/*
		if( box.container_id && (box.container_id != this.box_obj.container.id ))
		{
			var old_container = this.box_obj.container;

			var container = SButil.StateManager.lookupContainer( box.container_id );
			if( container ) this.bar.removeItem( this ); 			
		}
*/
	}
}

/*
	Function: onBoxItemDeactivated
	Callback for when the current box item should be deactivated
*/
function onBoxItemDeactivated (inEvent, inArgs )
{
	if( inArgs[0].box == this )
	{
		this.setActive( false );	
		SButil.EventManager.removeListener("BoxItemActivated", onActivationChanged, this );
	}
}

/*
	Function: onActivationChanged
	Called when the container activation changes 
*/
function onActivationChanged( inEvent, inArgs )
{
	if( inArgs[0] != this )
	{
		this.setActive( false );	
		SButil.EventManager.removeListener("BoxItemActivated", onActivationChanged, this );
	}
}

/*
BoxItem.prototype.showTooltip = function( inEvent, elm )
{
	elm.tooltipText = "temporary test for tooltip text";
	this.tooltip.show(inEvent, elm.htmlObj);
}

BoxItem.prototype.hideTooltip = function( inEvent, elm )
{
	this.tooltip.hide(inEvent);
}
*/

window['SB']['ui']['BoxItem'] = BoxItem;

function BoxItemDD( inObj, srcObj )
{
	BoxItemDD.superclass.constructor.call(this, inObj, null, { scroll:false } );

	var el = this.getDragEl(); 
	inObj.objlink = srcObj;
	YUIDom.setStyle(el, "opacity", 0.67); // The proxy is slightly transparent 
}

//BoxItemDD extends YUIDD.  
YAHOO.lang.extend( BoxItemDD, YUIDDProxy, 
{
	startDrag: function( x, y )
	{
		this.isReorder = false;

		// make the proxy look like the source element 
	        var dragEl = this.getDragEl(); 
	        var clickEl = this.getEl(); 
	        YUIDom.setStyle(clickEl, "visibility", "hidden"); 
	 
	        dragEl.innerHTML = clickEl.innerHTML; 
	 
	        YUIDom.setStyle(dragEl, "color", "#754C24"); 
	        YUIDom.setStyle(dragEl, "backgroundColor", "transparent"); 
	        YUIDom.setStyle(dragEl, "backgroundImage", "url(http://"+window["sb_static_image_host"]+"/images/box_normal.png)"); 
	        YUIDom.setStyle(dragEl, "backgroundRepeat", "no-repeat"); 
	        YUIDom.setStyle(dragEl, "border", "none"); 
	},

	endDrag: function( x,y )
	{
	        var srcEl = this.getEl(); 
	        var proxy = this.getDragEl(); 
	 
	        // Show the proxy element and animate it to the src element's location 
	        YUIDom.setStyle(proxy, "visibility", ""); 
	        var a = new YAHOO.util.Motion(  
	            proxy, {  
	                points: {  
	                    to: YUIDom.getXY(srcEl) 
	                } 
	            },  
	            0.2,  
	            YAHOO.util.Easing.easeOut  
	        ) 
	        var proxyid = proxy.id; 
	        var thisid = this.id; 
	 
	        // Hide the proxy and show the source element when finished with the animation 
	        a.onComplete.subscribe(function() { 
	                YUIDom.setStyle(proxyid, "visibility", "hidden"); 
	                YUIDom.setStyle(thisid, "visibility", ""); 
	            }); 
	        a.animate(); 

		if( this.isReorder )
		{
		        var srcEl = this.getEl(); 
	
			//Determine the new position
			var containing_div = srcEl.parentNode.parentNode;	
			var parent_node = srcEl.parentNode;	

			if( !containing_div || !parent_node ) return;

			for( var i = 0; i < containing_div.childNodes.length; i++ )
			{
				if( containing_div.childNodes[i] == parent_node && srcEl.objlink.box_obj.container )
				{
					var bid = srcEl.objlink.box_obj.box_id;
					var pd = "id="+bid+"&pos="+(i-1);
					YUIRequest.asyncRequest( "POST", "/box/update/", null, pd);
	
					
					var containerBoxList = srcEl.objlink.box_obj.container.box_list;
					containerBoxList.remove( srcEl.objlink.box_obj );
					containerBoxList.insertAt( srcEl.objlink.box_obj, (i-1) ); 		
					if( srcEl.objlink.containerView )
					{
						var blist = srcEl.objlink.containerView.box_view_list;
						blist.remove( srcEl.objlink );
						blist.insertAt( srcEl.objlink, (i-1) );
					}

					break;
				}
			}	
		}

	},

	onDrag: function(e) 
	{ 
	     // Keep track of the direction of the drag for use during onDragOver 
	     var y = YUIEvent.getPageY(e); 
	 
	     if (y < this.lastY) { 
	         this.goingUp = true; 
	     } else if (y > this.lastY) { 
	         this.goingUp = false; 
	     } 
	 
	     this.lastY = y; 
	}, 
	 
	onDragOver: function(e, id) 
	{ 
	     var srcEl = this.getEl(); 
	     var destEl = YUIDom.get(id); 
	 
	     // We are only concerned with list items, we ignore the dragover 
	     // notifications for the list. 
	     if (destEl.className == srcEl.className) 
	     { 
	         var orig_p = srcEl.parentNode; 
	         var p = destEl.parentNode.parentNode; 

		 this.isReorder = true;
	 
	         if (this.goingUp) { 
	             p.insertBefore(orig_p, destEl.parentNode); // insert above 
	         } else { 
	             p.insertBefore(orig_p, destEl.parentNode.nextSibling); // insert below 
	         } 
	 
	         YAHOO.util.DragDropMgr.refreshCache(); 
	     } 
	}, 

	onDragEnter: function( e, id )
	{
	     var srcEl = this.getEl(); 
	     var destEl = YUIDom.get(id); 

	     var destObj = destEl.objlink;	

	     if ( destObj &&
		       destObj.acceptsDrop &&
		       destObj.acceptsDrop( srcEl.objlink ) )
	     {
		destObj.handleDragEnter( e, srcEl.objlink );	
	     }
	},

	onDragOut: function( e, id )
	{
	     var srcEl = this.getEl(); 
	     var destEl = YUIDom.get(id); 

	     var destObj = destEl.objlink;	

	     if ( destObj &&
		       destObj.acceptsDrop &&
		       destObj.acceptsDrop( srcEl.objlink ) )
	     {
		destObj.handleDragOut( e, srcEl.objlink );	
	     }
	},

 	onDragDrop: function( e, id )
	{
	     var srcEl = this.getEl(); 
	     var destEl = YUIDom.get(id); 

	     var destObj = destEl.objlink;	

	     if ( destObj &&
		       destObj.acceptsDrop &&
		       destObj.acceptsDrop( srcEl.objlink ) )
	     {
		destObj.handleDrop( e, srcEl.objlink );	
	     }
	}, 

	onInvalidDrop: function( e )
	{


	}  


});



})();
