rem: var red = calcColor.substring( 0, 2 ); var green = calcColor.substring( 2, 4 ); var blue = calcColor.substring( 4, 6 ); 
add: var red = parseInt( calcColor.substring( 0, 2 ), 16 ); var green = parseInt( calcColor.substring( 2, 4 ), 16 ); var blue = parseInt( calcColor.substring( 4, 6 ), 16 ); 
context: function calendarColorStyleRuleUpdate( ThisCalendarObject ){   var j = -1;   var i;      // obtain calendar name from the Id   var containerName = ThisCalendarObject.Id.split(':')[2];   var tempStyleSheets = document.styleSheets;   for (i=0; i<tempStyleSheets.length; i++)   {      if (tempStyleSheets[i].href.match(/chrome.*\/skin.*\/calendar.css$/))	  {          j = i;          break;	  }   }   // check that the calendar.css stylesheet was found   if( j != -1 )   {	   var ruleList = tempStyleSheets[j].cssRules;	   var ruleName;	   for (i=0; i < ruleList.length; i++)	   {		  ruleName = ruleList[i].cssText.split(' ');		  // find the existing rule so that it can be deleted	      if (ruleName[0] == "." + containerName)		  {	         tempStyleSheets[j].deleteRule(i);	         break;	      }	   }	   // insert the new calendar color rule	   tempStyleSheets[j].insertRule("." + containerName + " { background-color:" +ThisCalendarObject.color + " !important;}",1);           var calcColor = ThisCalendarObject.color.replace( /#/g, "" );           var red = calcColor.substring( 0, 2 );           var green = calcColor.substring( 2, 4 );           var blue = calcColor.substring( 4, 6 );           // sum is between 3 * 255 = 765 and 0.           var sum = parseInt( red, 16 ) + parseInt( green, 16 ) + parseInt( blue, 16 );           // Consider all colors with a sum lower than 256 as dark backgrounds           // and use white as the foreground color.           if ( sum < 256 )              tempStyleSheets[j].insertRule( "." + containerName + " { color:" + " white" + "!important;}", 1 );	}}
meta: 10234	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/10234/5c63066297bf0f318d4409495d20bf0d47a7966b/calendarManager.js/buggy/calendar/resources/content/calendarManager.js