[SalesForce] Onmouseout event not working

I'm trying to show an iframe onmouseover event and close that iframe onmouseout. Onmouseover is working but not the onmouseout event. Here's what I have tried….

<apex:outputLink value="OrderTrackingClass?id={!o.id}" 
                 onmouseover="var awin=window.open('OrderLines?id={!o.id}','Order Lines','height=300, width=1000, left=400, scrollbars=yes');"
                 onmouseout="awin.close();">
    {!o.Orders__c}
</apex:outputLink>

What am I missing?

Best Answer

I think var is creating a private variable which is unknown to the onmouseout call. Removing var making the awin variable to available in global scope. So that onmouseout it's getting awin variable and closing it.