var isDOM = (document.getElementById ? true : false); 
var isIE  = (document.all ? true : false);
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isNS5 = ((!document.all && isDOM) ? true : false);

function ShowBT() {
  var Msg = '';
  Msg = Msg + (isDOM ? 'IsDOM : ' : '');
  Msg = Msg + (isIE ? 'IsIE : ' : '');
  Msg = Msg + (isIE4 ? 'IsIE4 : ' : '');
  Msg = Msg + (isNS4 ? 'IsNS4 : ' : '');
  Msg = Msg + (isNS5 ? 'IsNS5 : ' : '');
  window.alert('Browsertype: ' + Msg);
}

//ShowBT();

function getRef(id) {
if (isDOM) return document.getElementById(id);
if (isIE4) return document.all[id];
if (isNS4) return document.layers[id];
}

function getRef2(id,target) {
if (target) {
  if (isDOM) return target.getElementById(id);
  if (isIE4) return target.all[id];
  if (isNS4) return target.layers[id];
  }
else return null;  
}

function getSty(id) {
return (isNS4 ? getRef(id) : getRef(id).style);
} 

function getSty2(id) {
return (isNS4 ? id : id.style);
} 

function getForm(id) {
if (isNS4) return document.forms[id];
else return getRef(id);
}

function getImage(id) {
if (document.images) return document.images[id];
else return getRef(id);
}

function getImage2(id,target) {
if (target) {
  if (target.images) return target.images[id];
  else return getRef2(id,target);
  }
else return null;  
}
