Firefox Javascript does not work

This Javascript code gives a “imgobj has no properties” in second line “if” statement in Firefox:

function setSelectedElem(evt) {

var imgObj = (evt.imgObj) ? evt.imgObj : evt.srcElement;
if (imgObj.parentNode.id.indexOf(“dragimg”) != -1) {
selectedObj = imgObj.parentElement.style;
setZIndex(selectedObj,100);
return;
}
selectedObj = null;
return;
}

I am trying to convert this code to work in Firefox that currently only works in IE.