// nb customised to return null if no style object exists for the given id

function getIE4StyleObject(id) 

{ 

	el = document.all[id];

	if (el) return el.style; 

	return null;

}

function getNS4StyleObject(id) { return document.layers[id]; }

function getW3CStyleObject(id) 

{ 

	el = document.getElementById(id)

	if (el) return el.style;

	return null; 

}

var getStyleObject = null;

if (document.getElementById)

	getStyleObject = getW3CStyleObject;

else if (document.all)

	getStyleObject = getIE4StyleObject;

else 

	getStyleObject = getNS4StyleObject;


function getIE4Object(id) { return document.all[id]; }

function getNS4Object(id) { return document.layers[id]; }

function getW3CObject(id) { return document.getElementById(id); }

var getObject = null;

if (document.getElementById)

	getObject = getW3CObject;

else if (document.all)

	getObject = getIE4Object;

else 

	getObject = getNS4Object;


// from Danny Goodman's JavaScript & DHTML Cookbook, p.333

function getElementStyle(elemID, IEStyleProp, CSSStyleProp)

{

	var elem = document.getElementById(elemID);

	if (elem)

	{

		if (elem.currentStyle)

		{

			return elem.currentStyle[IEStyleProp];

		}

		else if (window.getComputedStyle)

		{

			var compStyle = window.getComputedStyle(elem, "");

			return compStyle.getPropertyValue(CSSStyleProp);

		}

	}

	return "";

}



