move header function inside document.ready