Change 'resize' to 'onresize' for window.attachEvent()