var i=0, n, p=inNode.parentNode; while((n = p.childNodes[i++])){ if(n == inNode){ return i - 1; } } return -1;