
#= require jquery

#= require jquery_ujs

#=require ./popover


$ ->
  
  resize = () ->

	  $(".middle").css
      "min-height" : ($(window).height()-$(".top").height()-$(".bottom").height()-20)+"px"
  
  resize()
  $(window).on "resize", ->
    resize()
    
    

$(window).load ->
  #resize()

  $(document).on "scroll", ->
    scroll_ajust()

  $(document).on "touchmove", ->
    scroll_ajust()

  scroll_ajust = () ->
    var_scroll = $(window).scrollTop()
    max = 200
    
    x = 1-(($(window).scrollTop()) / max)
    if x < 0.0
      x = 0
      
    if x > 1.0
      x = 1
  
        
    $("#blur").css("opacity", x)
    
    
    if var_scroll > 100
      $("#logo").fadeOut()
    else
      $("#logo").fadeIn()
      
    if var_scroll > 460 and !$("body").hasClass("page")
      $("#menu").addClass("move_top")
    else
      $("#menu").removeClass("move_top")
