Simple login window popup system

var _initialize = function () {
_doc = jQuery(document);
_win = jQuery(window);
_docHeight = _doc.height();
_winHeight = _win.height();
_winWidth = _win.width();
_overlay = jQuery('#myoverlay');
_logw = jQuery('#loginWindow');
};
var _center = function (w, h) { //center aligning of window
return [(_docHeight > _winHeight) ? _winWidth/2 - w/2 - 18: _winWidth/2 - w/2, _doc.scrollTop() + _winHeight/2 - h/2];
};
var _show = function(){
_overlay.show();
var pos = _center(_logw.width(), _logw.height());
_logw.css({left: pos[0] + 'px',top: pos[1] + 'px'}).show();
};
var _hide= function(){
_logw.hide();
_overlay.hide();
};
var _login= function(){
_initialize();
if($('.notify').text().length > 0 || _logw.hasClass('passwordRemindForm')) {
_show();
}
var mouse_is_inside = false;
$('.openLogin').click(function(){
_show(); return false
});
_logw.live({mouseenter:function(){
mouse_is_inside=true;
}, mouseleave:function(){
mouse_is_inside=false;
}
});
$('body').click(function(){
if(!mouse_is_inside) {
if (_logw.is(':visible')) {
_hide();
}
}
});
if(_logw.hasClass('passwordRemindForm')) {
$('body').unbind('click');
}
$('.close').live('click', function(){
_hide(); return false;
});
};


$(document).ready(function(){
_login(); //init login popup system
});