/** * Adds functions into window.load / onload event handlers * rather than writing over it. * * http://www.sitepoint.com/article/javascript-from-scratch/2 * http://simon.incutio.com/archive/2004/05/26/addLoadEvent */ function addLoadListener(fn) { if (typeof window.addEventListener != 'undefined') { window.addEventListener('load', fn, false); } else if (typeof document.addEventListener != 'undefined') { document.addEventListener('load', fn, false); } else if (typeof window.attachEvent != 'undefined') { window.attachEvent('onload', fn); } else { var oldfn = window.onload; if (typeof window.onload != 'function') { window.onload = fn; } else { window.onload = function() { oldfn(); fn(); }; } } } // getElementById returns null if there is no item with that id. function get_id_reference(id_target) { //alert(id_target); return document.all ? document.all[id_target] : document.getElementById(id_target); } function get_id_reference2(id_target) { if (document.getElementById) { return document.getElementById(id_target); } else if (document.all) { return document.all[id_target]; } else if (document.layers) { return document.layers[id_target]; } }