Issue with jquery.corners.js calculating background color

Issue with jquery.corners.js calculating background color


I'm having in issue using the jquery.corners.js plugin on a page. I
got the page working in my own mockup, but then had to ineherit some
older CSS for the site and that's when the problems started.
I've tracked the specific problem down to the alphaBlend function:
function alphaBlend(a, b, alpha) {
var ca = Array(
parseInt('0x' + a.substring(1, 3)),
parseInt('0x' + a.substring(3, 5)),
parseInt('0x' + a.substring(5, 7))
);
var cb = Array(
parseInt('0x' + b.substring(1, 3)),
parseInt('0x' + b.substring(3, 5)),
parseInt('0x' + b.substring(5, 7))
);
r = '0' + Math.round(ca[0] + (cb[0] - ca[0])*alpha).toString(16);
g = '0' + Math.round(ca[1] + (cb[1] - ca[1])*alpha).toString(16);
b = '0' + Math.round(ca[2] + (cb[2] - ca[2])*alpha).toString(16);
alert (r.substring(r.length - 2)
+ g.substring(g.length - 2)
+ b.substring(b.length - 2));
return '#'
+ r.substring(r.length - 2)
+ g.substring(g.length - 2)
+ b.substring(b.length - 2);
}
(not my alert in there for debugging)
What happens is the return string ends up being '#aNaNaN' which, I
assume, is invalid, as it causes the addCornerDiv function to bail:
function addCornerDiv(s, x, y, top, color) {
if (top && !s.tl) x.style.marginLeft = 0;
if (top && !s.tr) x.style.marginRight = 0;
if (!top && !s.bl) x.style.marginLeft = 0;
if (!top && !s.br) x.style.marginRight = 0;
x.style.backgroundColor = color;
if (top)
y.appendChild(x);
else
y.insertBefore(x, y.firstChild);
}
Specfically, on this line: x.style.backgroundColor = color;
So, that's my theory as to what's happening. Any theories as to why?
Since it WAS working and now isn't with new CSS, it's probably a CSS
issue (or maybe HTML?)...I'm just not sure whereabouts to start
looking.
-DA