 
   # HELPERS
   _sanitizeSizes:->
+
     @_setMinsAndMaxs()
-    o             = @getOptions()
-    nullCount     = 0
-    totalOccupied = 0
-    splitSize     = @_getSize()
-
-    # newSizes = for size,i in (if @sizes.length > 0 then @sizes else o.sizes)
-    newSizes = for size,i in o.sizes
-      if size is null
-        nullCount++
-        null
-      else
-        panelSize = @_sanitizeSize size
-        @_getLegitPanelSize size,i
-        # check maxs and mins
-        totalOccupied += panelSize
-        panelSize
-
-    @sizes = for size in newSizes
-      if size is null
-        nullSize = (splitSize - totalOccupied) / nullCount
-        Math.round nullSize
-      else
-        Math.round size
-
-    return @sizes
-
-  _sanitizeSize:(size)->
-    if "number" is typeof size or /px$/.test(size)
-      parseInt size, 10
+    {sizes} = @getOptions()
+    ss      = @_getSize()
+    s       = []
+    s[0]    = @_getLegitPanelSize @_sanitizeSize(sizes[0]), 0
+    s[1]    = @_getLegitPanelSize @_sanitizeSize(sizes[1]), 1
+    st      = s[0] + s[1]
+
+    if st > ss
+      s[1] = ss - s[0]
+    else if st < ss
+      if sizes[0] and (not sizes[1] or sizes[1] is 'auto')
+        s[1] = ss - s[0]
+      else if sizes[1] and (not sizes[0] or sizes[0] is 'auto')
+        s[0] = ss - s[1]
+
+
+    @size  = ss
+    log s, sizes, '-----------'
+    @sizes = s
+
+
+  _sanitizeSize: (size) ->
+
+    size = if "number" is typeof size then size
+    else if /px$/.test size    then parseInt size, 10
     else if /%$/.test size
-      splitSize = @_getSize()
-      splitSize / 100 * parseInt size, 10
+    then @_getSize() / 100 * parseInt size, 10
+    else @_getSize() / 2
+    size
 
   _setMinsAndMaxs:->
-    @getOptions().minimums ?= []
-    @getOptions().maximums ?= []
-    panelAmount = @getOptions().sizes.length or 2
-    for i in [0...panelAmount]
-      @getOptions().minimums[i] = if @getOptions().minimums[i] then @_sanitizeSize @getOptions().minimums[i] else -1
-      @getOptions().maximums[i] = if @getOptions().maximums[i] then @_sanitizeSize @getOptions().maximums[i] else 99999
+
+    {minimums, maximums} = @getOptions()
+
+    @minimums[0] = @_sanitizeSize minimums[0]
+    @minimums[1] = @_sanitizeSize minimums[1]
+    @maximums[0] = @_sanitizeSize maximums[0]
+    @maximums[1] = @_sanitizeSize maximums[1]
+
 
   _getSize:->
-    if @getOptions().type is "vertical" then @getWidth() else @getHeight()
+
+    if @size then @size
+    else if @getOptions().type is "vertical"
+    then @getWidth()
+    else @getHeight()
+
 
   _setSize:(size)->
     if @getOptions().type is "vertical" then @setWidth size else @setHeight size

  _createPanels:->

    panelCount = @getOptions().sizes.length
    @panels = (@_createPanel i for i in [0...panelCount])

  _createPanel:(index)->

    {type, fixed, minimums, maximums} = @getOptions()
    panel = new KDSplitViewPanel
      cssClass : "kdsplitview-panel panel-#{index}"
      index    : index
      type     : type
      size     : @_sanitizeSize @sizes[index]
      fixed    : yes                            if fixed[index]
      minimum  : @_sanitizeSize minimums[index] if minimums
      maximum  : @_sanitizeSize maximums[index] if maximums

    panel.on "KDObjectWillBeDestroyed", => @_panelIsBeingDestroyed panel
    @emit "SplitPanelCreated", panel

    @sizes        = @sizes.slice(0,index).concat(@sizes.slice(index+1))
    @panelsBounds = @panelsBounds.slice(0,index).concat(@panelsBounds.slice(index+1))

    @minimums[index] = 0
    @maximums[index] = @_getSize()
    o.views[index]   = null  if o.views[index]?

  # CREATE RESIZERS

