Ok I have done this which seems to work ok- probably dont need to use jQuery but I'll post an update...
splitBgImage : function(string) {
//split the background-image string into an array of characters
//iterate over the array of characters adding each to the bgimg variable
//if we encounter a ( then we increment brackets by one
//if we encounter a ) then we decrement brackets by one
//if we encounter a , then if brackets == 0 then we push the bgimg property to the bgimgs array and set the bgimg property back to ''
//if we are at the end of the array add whats left to bgimgs minus the ';'
var brackets = 0, bgimg = '', bgimgs = [], splitString = string.split(''), totalLength = jQuery(splitString).length;
jQuery.each(splitString, function(index, char){
if(char == '(')
{
brackets ++;
}
if(char == ')')
{
brackets -- ;
}
if(char == ',' && brackets == 0)
{
bgimgs.push(bgimg);
bgimg = '';
}
else
{
if(char != ';')
bgimg += char;
}
if(index == totalLength-1)
{
bgimgs.push(bgimg);
}
});
return bgimgs;
}