I bind these two event handlers to buttons on an html page ( $('div [id^="button"]').bind({ )
when the page loads (document.ready) and the mouse is initially positioned over a "button" the mouseout fires.
$('div [id^="button"]').bind({
mouseenter:function(){
registerButtonOver=1;//have to register the fact that the mouse was over on page load or mouse out fires
mouseTrack=0;//do not track the mouse positon
insideButton=1;//the mouse IS inside the button
},
mouseout:function(){/* WE LEAVE THE BUTTON */
mouseTrack=1;//track the position of the mouse
insideButton=0;//the mouse is NOT inside the button
if(registerButtonOver==1){
if(stopreadreg==0){
var regTime = new Date().getTime();
alert('mouseleave');stoppedReading(regTime);
}
}//set the time that the learner STOPPED READING
},