// Funkcje pomocnicze, operujace na obiektowym modelu dokumentu

function getStyle(obj, id, style) {
	var s;
	if (!obj && id) obj= getElement(id);
	if (obj && obj.style) s= obj.style; else s= obj;
	if (s && style) s= eval('s.' + style);
	return s;
}

function getCurrentStyle(obj, id, style) {
	var s;
	if (!obj && id) obj = getElement(id);
	if (document.defaultView && document.defaultView.getComputedStyle) {
		s= document.defaultView.getComputedStyle(obj, null);
		if (s.getPropertyValue) {
			var tmp = style.replace(/className/, "class");
			var domstyle = "";
			var ind;
			while ((ind = tmp.search(/[A-Z]/)) >= 0) {
				domstyle += tmp.substr(0, ind) + '-' + tmp.charAt(ind).toLowerCase();
				tmp = tmp.substr(ind + 1);
			}
			domstyle += tmp;
			s = s.getPropertyValue(domstyle);
		} else {
			s = eval('s.' + style);
			if (typeof(s) == 'undefined' || typeof(s) == 'unknown') {
				s = null;
			}
		}
	} else if (obj.currentStyle && obj.currentStyle.getAttribute) 
		s = obj.currentStyle.getAttribute(style);
	else if (obj.currentStyle) 
		s = eval('obj.currentStyle.' + style);
	else
		s = null;
	return s;
}
