javascript DOMReady function
DOMContentLoaded Problem for cross browser and a window.setTimeout solution:
function DOMReady(f){
if (/(?!.*?compatible|.*?webkit)^mozilla|opera/i.test(navigator.userAgent)){ // Feeling dirty yet?
document.addEventListener("DOMContentLoaded", f, false);
} else {
window.setTimeout(f,0);
}
}
I found this on