Dragging duplicated MC on another MC

Me and my problems again:)

Now i want to have an MC which would duplicate on click and attach itself to another MC so that it would be still visible when its former parent would hide (exit from menu).
Also it shouldnt duplicate when on that another MC.
I tried to do it like this:


on(press){
    var ref=this._parent._parent; //_root
    if(this._parent != winGV_mc){
        duplicateMovieClip(this, "win"+ref.numWindows, ref.dWindows);
        ref.winGV_mc.attachMovie("win"+ref.numWindows, "win"+ref.numWindows, ref.dWindows);
        this._parent["win"+ref.numWindows].removeMovieClip();
        ref.numWindows++;
        ref.dWindows++;
    }
    startDrag(this, false);
}
on(release){
    stopDrag();
}

But all it does is move the MC and not duplicate it. If i dont remove it then it duplicates every time i click on it. And it doesnt attach itself on another MC -when i “close” (hide) the menu these MCs go with it. I know im not referencing the right MC but how do i fix this?