.center_content
  .circuit_show
    
        
    %h1
      =@circuit.name
      
    .info_lien

      -if @circuit.logo
        .right
          =image_tag(@circuit.logo.file.large.medium.url, :class => "logo" )
      
      -if @circuit.longueur?
        .block_info
          %img{:src => "/images/interface/picto_flag.png"}/
          =@circuit.longueur


      -if @circuit.nbr_courbes?
        .block_info
          %img{:src => "/images/interface/picto_nombre_virages.png"}/
          =@circuit.nbr_courbes

      -if @circuit.longueur_ligne?
        .block_info
          %img{:src => "/images/interface/picto_longueur_circuit.png"}/
          =@circuit.longueur_ligne

    

    .clear

    -img = ""
    -img = @circuit.image_file.file.large.medium.url if @circuit.image_file 
    
    =image_tag img, :class => "circuit_img"
    .description
      =simple_format @circuit.description

      %br
      
        .right
          -if @circuit.website?
            =link_to "Site officiel", @circuit.website, :target => "_blank", :class => "new_btn"
          -if @circuit.facebook?
        
            =link_to raw(ic(:'facebook-f')), @circuit.facebook, :target => "_blank", :class => "new_btn"
        .mobile_clear
        %p.localisation
          =#<img src="/images/interface/picto_pointer.png">
          =@circuit.address2
          =@circuit.address3 if @circuit.address3?
          =@circuit.cp
          =@circuit.city
          
          
          -if @circuit.country? and @circuit.country.to_s != "FR"
            ="-"
            
            =image_tag "/countries/#{@circuit.country.downcase}.png", :class => "country_icon"
            
            = ISO3166::Country[@circuit.country].translations["fr"]
          
      .clear
    .clear
    %br
    %br
    
    
    
    -@m_events = MEvent.where("start_at >= ? or end_at >= ?", Date.today.beginning_of_day, Date.today.beginning_of_day).where(:circuit_id => @circuit.id)
    -params[:search][:per_page] = params[:search][:per_page] || 4
    -per_page = params[:search][:per_page]
    -page = (params[:page] and params[:page] != "") ? params[:page] : 1 
    -@m_events = @m_events.order("start_at ASC").page(page).per(per_page)
    
    -if @m_events.count > 0
      %h3 Les prochaines journées :



      

      =render @m_events 
   
      .prevnext= paginate @m_events 
