<script type="text/javascript" src="//code.internetrange.com/jquery-1.11.0.js"></script>
<script>
$(document).ready( function() {
var overiFrame = -1;
$('iframe').hover( function() {
overiFrame = $(this).closest('.iframetrack').attr('bannerid');
}, function() {
overiFrame = -1
});
$(window).blur( function() {
if( overiFrame != -1 )
alert('22');
});
});
</script>
<div align="center" class="iframetrack" bannerid='yyy'>
<iframe width="100" height="100" border="1" frameborder="1" style="border: 1px solid #996666; visibility: visible;" scrolling="no" src="http://yandex.ru"></iframe>
</div>