jQuery: Change part of background CSS

I’m making a realtime css editor using jQuery and it works just perfect except for one thing…

When I use solid backgrounds it works fine like this:

jQuery("#boxtitleback").attachColorPicker();
jQuery("#boxtitleback").change(function() {jQuery('#boxtitle h1').css("background-color",jQuery("#boxtitleback").getValue())});

But what if I want to change one color of an -webkit-gradient???

How do i do that?
background:-webkit-gradient(linear,0% 0,0% 100%,from(#333),to(#5e5e65));

Thanks in advance :wink:

Have you tried taking a look at how others do it?
http://gradients.glrzad.com/