As you know the getElementById is new method in modern browsers. Long time ago old browsers did not support this cool method. So this function was invented for accessing DOM objects in all browsers.
var dom = (document.getElementById) ? true : false;
var ns5 = ((navigator.userAgent.indexOf("Gecko")>-1) && dom) ? true: false;
var ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
var ns4 = (document.layers && !dom) ? true : false;
var ie4 = (document.all && !dom) ? true : false;
function GetObj(id)
{
if (dom) return document.getElementById(id);
return (ns4) ? document.layers[id] : (ie4) ? document.all[id] : (ie5||ns5) ? document.getElementById(id) : null;
}