# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/

$(document).ready ->
  $(document).foundation('joyride', {cookie_monster: true, cookie_expires: 999})
  $(document).foundation('joyride', 'start')

  $('#email_signup_form').hide()
  $('#email_signup_button').click ->
    $('#email_signup_form').slideDown()

DropDown = (el) ->
  @dd = el
  @initEvents()

DropDown:: = initEvents: ->
  obj = this
  obj.dd.on "click", (event) ->
    $(this).toggleClass "active"
    event.stopPropagation()


$ ->
  dd = new DropDown($("#dd"))
  $(document).click ->

    # all dropdowns
    $(".wrapper-dropdown").removeClass "active"
