document.ready like functionality in javascript?
===

I have a requirement that states to use only plain javascript and not jquery. I need to initialize some variables(using some function) as soon as the page is requested and not when the page has fully loaded. In short it should not wait for the whole page to load. In jquery it can be very easily done using document.ready() function.

Is it possible to implement it in javascript using any function ?Please help !!!!