         parent.subviews.push(@)
         parent.trigger('subviews', @) if parent.events?['subviews']
         parent = parent.sprite
+
       @sprite.set_parent parent
-
     set_id: (@id) ->
       @sprite.set_id(id)
 

#    guid = 0
    stylemap= {x: 'left', y: 'top', bgcolor: 'background-color'}

    constructor: (@jqel = $('<div/>'), view) ->
      # console.log 'new sprite', @jqel, view
      @jqel = $(@jqel) unless @jqel instanceof jQuery
      @jqel[0].$view = view

      # normalize to jQuery object
#      guid++
#      @jqel.attr('id', 'jqel-' + guid) if not @jqel.attr('id')
      @jqel.addClass('sprite')
    setStyle: (name, value) ->
      value ?= ''
      name = stylemap[name] if name of stylemap
      # console.log('setStyle', name, value, @jqel[0])
      @jqel.css(name, value)
    set_parent: (parent) ->
      if parent instanceof Sprite
        parent = parent.jqel

      parent = $(parent) unless parent instanceof jQuery
      # console.log 'set_parent', parent
      parent.append(@jqel)
    set_id: (@id) ->
      # console.log('setid', @id)
      @jqel.attr('id', @id)
    animate: =>
      # console.log 'sprite animate', arguments, @jqel
      @jqel.animate.apply(@jqel, arguments)


        parent = new lz[extend](instanceel, attributes)
        # console.log 'created instance', name, extend, parent

        return if not (viewel = parent.sprite?.el)

        viewel.innerHTML = body
        children = (child for child in viewel.childNodes when child.nodeType == 1)
