function set_style_attribute(e,k,v)
{
// Skip if there's no element
	if (e == null ||
		e == undefined ||
		e == 'undefined' ||
		e.style == null ||
		typeof e.style == undefined ||
		typeof e.style == 'undefined') 
      return;

	try {
	// Try setAttribute
		if (typeof e.style.setAttribute != undefined && typeof e.style.setAttribute != 'undefined')
			e.style.setAttribute(k,v);

	// Try setProperty
		if (typeof e.style.setProperty != undefined && typeof e.style.setProperty != 'undefined')
		{
			try {e.style.setProperty(k,v); } catch (ex1) { e.style.setProperty(k,v,''); }
		}

	// Try setAttributeNS
		if (typeof e.style.setAttributeNS != undefined && typeof e.style.setAttributeNS != 'undefined')
			e.style.setAttributeNS(k,v);

	// Fall back on direct access	
		var key = k.replace('/-[a-zA-Z]/g', function(s) { return s.charAt(1).toUpper() });

		var key_type = typeof e.style[key];
		if (key_type != undefined && key_type != 'undefined')
			e.style[key] = v;
	} catch (ex) {
		if (k == 'display' && v == 'table-row')
			set_style_attribute(e,k,'block');
		else
			alert(ex.message+'\nsetting '+k+' to '+v);
	}
}

function get_style_attribute(e,k)
{
  var value = '';
	try {
	// Skip if there's no element
		if (!e || !e.style) return '';

	// Try getAttribute
		if (typeof e.style.getAttribute != undefined &&
			typeof e.style.getAttribute != 'undefined')
			return e.style.getAttribute(k);

	// Try getPropertyValue
		if (typeof e.style.getPropertyValue != undefined &&
			typeof e.style.getPropertyValue != 'undefined')
			return e.style.getPropertyValue(k);

	// Fall back on direct access
		key = k.replace('/-[a-zA-Z]/g', function(s) { return s.charAt(1).toUpper() });
		value = e.style[key];
	} catch(ex) { }
	return value; 
}
