function getItemIndex(elm) { var parent = glow.dom.get(elm.parentNode), counter = 0; parent.children().each(function(){ if (glow.dom.get(this).item(0) == glow.dom.get(elm).item(0)) { return counter; } else { counter++; } }); return -1; }