Wrapped JS function in document.ready event