Resizable and z-index

Resizable and z-index


Hello all,
I'm working on bit of ui that is using the resizable and draggable
plug-ins. They work great so far, but I also need to be able to tamper
with the z-index being used. When the object is draggable, I can
easily change the z-index and make it move forward or backward.
However, when it is resizable, I can't. Here is the code I'm using to
change the z-index. SelObj is always an image. When it has a text
attribute added to it, it isn't resizable, otherwise it is.
Any ideas why this wouldn't work?
function MoveDown() {
    var idx;
    var target;
    if (selObj.attr('text') != undefined)
    {
        idx = parseInt(selObj.css('z-index'));
        target = selObj;
    }
    else
    {
        idx = parseInt(selObj.parent().css('z-index'));
        target = selObj;
    }
    if (idx == undefined || idx == 'auto' || idx == 'NaN')
    {
        target.css('z-index', 0);
    }
    if (idx - 1 > 0)
    {
        target.css('z-index', idx - 1);
    }
}