   
 # Shows image with specified index from images array
 showImage = (index, direction = undefined) ->
-  img = $('<img />')
-    .attr(hermitage.image.default.attributes)
-    .css(hermitage.image.default.styles)
+  img = createElement($('<img />'), hermitage.image)
     .attr('src', sourceFor(index))
-    .css(hermitage.image.styles)
     .hide()
     .appendTo($('#hermitage'))
   


# Creates base navigation button and returns it
createNavigationButton = ->
  $('<div>')
    .appendTo($('#hermitage'))
    .hide()
    .css(hermitage.navigationButtons.default.styles)
    .maximizeLineHeight()
    .css(hermitage.navigationButtons.styles)

# Creates right navigation button and returns it
createRightNavigationButton = ->
  createNavigationButton()
    .attr(hermitage.navigationButtons.next.default.attributes)
    .css(hermitage.navigationButtons.next.default.styles)
    .css(hermitage.navigationButtons.next.styles)
    .text(hermitage.navigationButtons.next.text)
    .click(showNextImage)

# Create left navigation button and returns it
createLeftNavigationButton = ->
  createNavigationButton()
    .attr(hermitage.navigationButtons.previous.default.attributes)
    .css(hermitage.navigationButtons.previous.default.styles)
    .css(hermitage.navigationButtons.previous.styles)
    .text(hermitage.navigationButtons.previous.text)
    .click(showPreviousImage)

# Creates close button
createCloseButton = ->
  $('<div>')
    .appendTo($('#hermitage'))
    .hide()
    .attr(hermitage.closeButton.default.attributes)
    .css(hermitage.closeButton.default.styles)
    .text(hermitage.closeButton.text)
    .css(hermitage.closeButton.styles)
    .click(closeGallery)

createBotomPanel = ->
  bottomPanel = $('<div>')
    .appendTo($('#hermitage'))
    .hide()
    .attr(hermitage.bottomPanel.default.attributes)
    .css(hermitage.bottomPanel.default.styles)
    .css(hermitage.bottomPanel.styles)

  text = $('<div>')
    .appendTo(bottomPanel)
    .attr(hermitage.bottomPanel.text.default.attributes)
    .css(hermitage.bottomPanel.text.default.styles)
    .css(hermitage.bottomPanel.text.styles)

# Shows original image of the chosen one
openGallery = (image) ->

  # Bottom panel (for text or anything else)
  bottomPanel:
    default:
      attributes: { class: 'bottom-panel' }
      styles:
        position: 'absolute'
        bottom: 0
