
 menuItem = function(id, sGroup, config) {

    if (id) {
        this.init(id, sGroup, config);
        this.initFrame();
    }

  //  var s = this.getDragEl().style;
  //  s.borderColor = "transparent";
   // s.backgroundColor = "#f6f5e5";
   // s.opacity = 0.76;
   // s.filter = "alpha(opacity=76)";	
};

YAHOO.extend( menuItem, YAHOO.util.DDProxy);

 menuItem.prototype.startDrag = function(x, y) {
  var dragEl = this.getDragEl();
  var clickEl = this.getEl();
  dragEl.innerHTML = clickEl.innerHTML;
};

 menuItem.prototype.endDrag = function(e) {
    // disable moving the linked element
};

 menuItem.prototype.onDrag = function(e, id) {
};

 menuItem.prototype.onDragDrop = function(e, id) {
  	 var currentElement = this.getEl()
	 var contentParent = currentElement.parentNode;
	 if(contentParent.id=='listGroup') {
      // add in the new component
         var newComponent = document.createElement('div');
	     newComponent.id= parseInt(contentProcessor.returnNumberOfComponents())+1;
	     newComponent.className = "sortList" 
	 
	  //make it moveable and give it a handle 
	    DD = new  DDItem(newComponent.id);
	    DD.setHandleElId("h");
	 
        var menuPlaceHolder = YAHOO.util.DDM.getElement(this.id + 'PlaceHolder');
	    menuPlaceHolder.className = "hiddenMenu";
	  
	    var theMenu = YAHOO.util.DDM.getElement('menu')
	    contentParent.insertBefore(newComponent,currentElement);
	    theMenu.insertBefore(currentElement, menuPlaceHolder);
	    contentProcessor.updateXMLAfterMenuDrop(contentProcessor.xmlContent, this.id, newComponent.id);
	    formManager.attachFormBehaviours("form_" + newComponent.id);
	    newComponent.style.overflow="auto" 
	}
};


 menuItem.prototype.onDragOver = function(e, id) {
    var el;
    if ("string" == typeof id) {
        el = YAHOO.util.DDM.getElement(id);
    } else { 
        el = YAHOO.util.DDM.getBestMatch(id).getEl();
    }
    var mid = YAHOO.util.DDM.getPosY(el) + ( Math.floor(el.offsetTop / 2));
    if (YAHOO.util.Event.getPageY(e) < mid) {
	    var el2 = this.getEl();	
		var placeholder = YAHOO.util.DDM.getElement(el2.id + "PlaceHolder");
		var p = el.parentNode;
		if (p.id == 'listGroup') {
		  placeholder.className = "visibleMenu";
          p.insertBefore(el2, el);
		}
    }
};

 menuItem.prototype.onDragEnter = function(e, id) {
};

 menuItem.prototype.onDragOut = function(e, id) {
};

 menuItem.prototype.toString = function() {
    return this.id;
};

menuItem.prototype.onMouseUp = function(){
  this.onDragDrop();
};




