function hover (opt) {
opt.elem.onmouseover = ElemMouseAction;
opt.elem.onmouseout = ElemMouseAction;
function ElemMouseAction (evt) {
var related, Call;
var e = evt || event;
if(e.type == 'mouseover'){
Call = opt.over;
related = e.relatedTarget || e.fromElement;
} else {
Call = opt.out;
related = e.relatedTarget || e.toElement;
}
while (related && related != this) {
related = related.parentNode;
}
if(related == this) return;
Call();
}
}
hover({
elem:document.getElementById('#bla'),
over:function () {// срабатывает при mouseover
},
out:function (){// срабатывает при mouseout
}
});