add:  if (v.substr(0, 3) == "rgb") {  var re = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/; if (v.match(re)) { var r = parseInt(RegExp.$1); var g = parseInt(RegExp.$2); var b = parseInt(RegExp.$3); return "#" + hex(r) + hex(g) + hex(b); }   return null; }  if (v.substr(0, 1) == "#") {  return v; }   
context: HTMLArea._colorToRgb = function(v) {	// returns the hex representation of one byte (2 digits)	function hex(d) {		return (d < 16) ? ("0" + d.toString(16)) : d.toString(16);	};	if (typeof v == "number") {		// we're talking to IE here		var r = v & 0xFF;		var g = (v >> 8) & 0xFF;		var b = (v >> 16) & 0xFF;		return "#" + hex(r) + hex(g) + hex(b);	}	if (v.substr(0, 3) == "rgb") {		// in rgb(...) form -- Mozilla		var re = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/;		if (v.match(re)) {			var r = parseInt(RegExp.$1);			var g = parseInt(RegExp.$2);			var b = parseInt(RegExp.$3);			return "#" + hex(r) + hex(g) + hex(b);		}		// doesn't match RE?!  maybe uses percentages or float numbers		// -- FIXME: not yet implemented.		return null;	}	if (v[0] == "#") {		// already hex rgb (hopefully :D )		return v;	}	// if everything else fails ;)	return null;};
meta: 6230	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/6230/e9ff05661c4fa38c1e8ce4b72bf5b0a3bb5e0842/htmlarea.js/buggy/phpgwapi/js/htmlarea/htmlarea.js