function d2h(dec) { 
       return dec.toString(16);
}

function h2d(hex) { 
       return parseInt(hex,16);
}

function rgb2h(r,g,b) { 
         return [d2h(r),d2h(g),d2h(b)];
}

function h2rgb(h,e,x) {
        return [h2d(h),h2d(e),h2d(x)];
}

function cssColor2rgb(color) {
     if(color.indexOf('rgb')<=-1) {
     return h2rgb(color.substring(1,3),color.substring(3,5),color.substring(5,7));
     }
     return color.substring(4,color.length-1).split(',');
}
