var applyStyles = function (newStyles, sharedStyles) {

  removeAllStyles();

  for(var i=0; i<newStyles.length; i++) {
    createStyle(newStyles[i]);
  }

  function createStyle(style) {
    if(style.Style == "") { return; }

    var sharedStyle = MSShapeGroup.alloc().init().style();

    if(style.Background) {
      var fill = sharedStyle.fills().addNewStylePart();
      fill.color = MSColor.colorWithSVGString("#" + style.Background);
    }

    if(style.Borderthickness > 0 && style.Bordercolor) {
      var borders = sharedStyle.borders().addNewStylePart();
      borders.thickness = style.Borderthickness;
      borders.color = MSColor.colorWithSVGString("#" + style.Bordercolor);
    }

    if(style.Shadow) {
      var shadow = sharedStyle.shadows().addNewStylePart();
      shadow.color = MSColor.blackColor().colorWithAlpha(style.Shadowopacity);
      shadowAttr = style.Shadow.split(',');
      shadow.offsetX    = shadowAttr[0];
      shadow.offsetY    = shadowAttr[1];
      shadow.blurRadius = shadowAttr[2];
      shadow.spread     = shadowAttr[3];
    }

    sharedStyles.addSharedStyleWithName_firstInstance(style.Style, sharedStyle);
  }

  function removeAllStyles() {
    var existingStyles = sharedStyles.objects();

    while(existingStyles.count() > 0) {
      style = existingStyles.objectAtIndex(0);
      [existingStyles removeObject:style];
    }
  }
}

@@ -783,16 +783,19 @@
     
+var 
 shadow
-.c
+C
 olor
@@ -809,20 +809,85 @@
 lor.
-blackColor()
+colorWithSVGString(%22#%22 + style.Shadowcolor);%0A      shadow.color = shadowColor
 .col
@@ -923,24 +923,27 @@
 ty);%0A      s
+etS
 hadowAttr = 
@@ -943,157 +943,312 @@
 Attr
- = style.Shadow.split(',');%0A      shadow.offsetX    = shadowAttr%5B0%5D;%0A      shadow.offsetY    = shadowAttr%5B1%5D;%0A      shadow.blurRadius = shadowAttr%5B2%5D
+ibute(shadow, style.Shadow);%0A    %7D%0A%0A    if(style.Innershadow) %7B%0A      var innerShadow = sharedStyle.innerShadows().addNewStylePart();%0A      var innerShadowColor = MSColor.colorWithSVGString(%22#%22 + style.Innershadowcolor);%0A      innerShadow.color = innerShadowColor.colorWithAlpha(style.Innershadowopacity)
 ;%0A  
@@ -1256,40 +1256,57 @@
    s
+etS
 hadow
-.spread     = shadowAttr%5B3%5D
+Attribute(innerShadow, style.Innershadow)
 ;%0A  
@@ -1607,16 +1607,16 @@
 style%5D;%0A
-
     %7D%0A  
@@ -1616,11 +1616,266 @@
    %7D%0A  %7D
+%0A%0A  function setShadowAttribute(shadow, shadowStyle) %7B%0A    shadowAttr = shadowStyle.split(',');%0A    shadow.offsetX    = shadowAttr%5B0%5D;%0A    shadow.offsetY    = shadowAttr%5B1%5D;%0A    shadow.blurRadius = shadowAttr%5B2%5D;%0A    shadow.spread     = shadowAttr%5B3%5D;%0A  %7D
 %0A%7D%0A

Add support for shadow color, and inner shadow