
#= require jquery

#= require jquery_ujs

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

#= require ./vendor/jquery.mask

#= require ./vendor/jquery.bxslider

#=require ./popover

top = 150


@resize = () ->
  #top = $("#menu_top_container").outerHeight()

  margin_top = ($(window).height() - $("#protest_instruction .inner").outerHeight()) / 2

  $("#protest_instruction .inner").css("height", ($(window).height()*0.90)+"px")
  $("#protest_instruction .inner").css("margin-top", margin_top+"px")
  
  
  scroll_ajust()
  #$(".bxslider li").each ->
  #  width = $(this).parent().width()
  #  $(this).css("width",$(this).parent().width()+"px")
  $("#main").css
    "min-height" :$(window).height()+"px"
  #$(this).closes
  
  $(".menu_itemlink_content").css("height", "auto");
  
  
  $("#photos .left img").each ->
  
    ratio = 0.56
    height = $(this).width()*ratio
    $(this).css("height",height+"px")
   
  $("#top_block .inner").each ->
  
    ratio = 0.65
    height = $(this).width()*ratio
    #$(this).css("min-height",height+"px")
  
  
    
 
  test = 10

  #$("#home_slider").css("height", ($("#main").width()*(640 / 1200))+"px")

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

      
    #alert rp_top_start
    
    #menu
    if var_scroll > top
      $("#top_menu").addClass("move_top")
     
      
    else
      $("#top_menu").removeClass("move_top")
      
    #top_link
    if var_scroll > 100
      $(".top_link").css
        "opacity" : 1
    else
      $(".top_link").css
        "opacity" : 0
  
  
  
  


$ ->
  
  
  
  
  

  $(window).on "resize", ->
    resize()


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

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


