$('#w').window({ onMaximize:function(){ $(this).window('window').css('z-index',++$.fn.window.defaults.zIndex); }})