/**
 * @author Michael
 */
function getBgColor(elementId) {
	color = ""
	// IE
	try { color = document.getElementById(elementId).currentStyle.backgroundColor; } catch (e) {}
	// Gecko
	try { 
		color = window.getComputedStyle(document.getElementById(elementId), elementId).getPropertyValue('background-color'); 
		if (color.indexOf(')') > 0) color = rgbConvert(color);
	} catch (e) {}
	if (color != "") {
		return color;
	} else {
		return false;
	}
}

function rgbConvert(str) {
   str = str.replace(/rgb\(|\)/g, "").split(",");
   str[0] = parseInt(str[0], 10).toString(16).toLowerCase();
   str[1] = parseInt(str[1], 10).toString(16).toLowerCase();
   str[2] = parseInt(str[2], 10).toString(16).toLowerCase();
   str[0] = (str[0].length == 1) ? '0' + str[0] : str[0];
   str[1] = (str[1].length == 1) ? '0' + str[1] : str[1];
   str[2] = (str[2].length == 1) ? '0' + str[2] : str[2];
   return ('#' + str.join(""));
}


