
#= require jquery

#= require jquery_ujs

#= require vendor/jquery-ui

#= require bootstrap

#= require ./vendor/jquery.flexslider
#= require ./vendor/markerclusterer

#= require ./vendor/jquery.mask
#= require ./vendor/jquery.fitvids
#= require ./vendor/jquery.bxslider
#= require redactor
#= require redactor_plugins/fontsize
#= require redactor_plugins/fontfamily
#= require redactor_plugins/fontcolor

#= require vendor/flipclock.js
#= require vendor/jquery.cookiebar.js

#=require ./popover
top = 20


$(document).ready -> 
  
  $(document).on 'click', 'input.datepicker', ->
    $(this).datetimepicker(
      language: 'fr'
      pickTime: false
    ).focus();
    
  $(document).on 'click', 'input.datetimepicker', ->
    $(this).datetimepicker(
      use24hours: true
      format: 'DD/MM/YYYY HH:mm'
      minuteStepping:15
      language: 'fr'
    ).focus();
    
    
  $(document).on 'click', 'input.timepicker', ->
    $(this).datetimepicker(
      use24hours: true
      format: 'DD/MM/YYYY hh:mm'
      minuteStepping:15
      pickDate: false
      language: 'fr'
    ).focus();


@scroll_ajust = () ->
  var_scroll = $(window).scrollTop()
  


@resize = () ->
  
  $(".with_ratio").each ->
    ratio = parseFloat($(this).data("ratio"))
    height = $(this).width()*ratio
    
    $(this).css("height",height+"px")
    
  
  $(".vertical_center").each ->
    height = $(this).parent().height()
    margin = ((height-$(this).outerHeight())/ 2)

    $(this).css('margin-top', (margin-1)+"px")
    
  $('.column_inner').each ->
    $(this).css('margin-top', "0px")

    height = $(this).closest('.row').height()
    margin = ((height-$(this).outerHeight())/ 2)

    $(this).css('margin-top', (margin-1)+"px")
  
  
  
      
$ ->
  $(window).on "resize", ->
    resize()


  
  resize()
  
  $(".flashs .remove").click ->
    $(this).parent().remove()
  $(document).on "scroll", ->
    scroll_ajust()
    resize()
  
  $(document).on "touchmove", ->
    scroll_ajust()
    resize()

  
  $(".top_link").click ->
    $('html,body').animate({scrollTop: 0},'slow');
  

  
  











