<!DOCTYPE html>
<html>
  <head>
    <title><%= full_title(yield(:title)) %></title>

    <!--[if IE]>
    <link rel="stylesheet" type="text/css" href="css/ie.css" media="screen, projection"/>
    <![endif]-->
    <!--<link href='http://fonts.googleapis.com/css?family=Raleway:100,200,300,400,500,600,700' rel='stylesheet' type='text/css'>-->
    <%= stylesheet_link_tag "web/web", media: "all" %>
    <%= include_gon(:init => true) %>
    <%= csrf_meta_tags %>
    <meta name="description" content="<%= meta_description(yield(:description)) %>">
    <% if content_for?(:social_meta) %>
        <%= yield(:social_meta) %>
    <% else %>
        <%= render "layouts/social_meta" %>
    <% end %>
    <%= render "shared/ad_sense" %>
    <% if @responsive %>
      <meta name="viewport" content="width=device-width, initial-scale=1">
    <% end %>
  </head>
  <body class="web jam <%= yield(:page_name) %> <% @responsive ? 'responsive' : 'not-responsive' %>">
    <%= javascript_include_tag "web/web" %>
    <div class="dialog-overlay op70" style="display:none; width:100%; height:100%; z-index:99;"></div>

    <div class="wrapper">

      <% if @no_user_dropdown %>
      <% else %>
        <% unless @welcome_page %>
            <%= render "users/user_dropdown" %>
        <% else %>
            <%= render "users/video_carousel" %>
        <% end %>
      <% end %>

      <div class="logo-home">
        <%= link_to root_path do %>
            <%= image_tag("web/logo_home.png", :alt => "JamKazam logo", :size => "298x54") %>
        <% end %>
      </div>

      <% if !@welcome_page && !@no_landing_tag %>
        <div class="landing-tag <%= @no_user_dropdown ? 'no-user-dropdown' : '' %>">
          <h1>Live music platform & <br/> social network for musicians</h1>
        </div>
        <div class="clearall"></div>
      <% elsif @landing_tag_play_learn_earn %>
        <div class="landing-tag-play-learn-earn">
          <h1 class="web-tagline">WHERE MUSICIANS CONNECT, PLAY, LEARN, & EARN</h1>
        </div>
      <% end %>

      <% if @show_cta_free_jamtrack %>
        <div class="cta-free-jamtrack">
        <%= link_to image_tag("web/free-jamtrack-cta.png", :alt => "ClICK HERE TO PICK YOUR FIRST JAMTRACK FREE!"), "/client#/jamtrack/search", class: "cta-free-jamtrack" %>
          <span class="value-indicator">$2.99 value</span>
        </div>
      <% end %>
    </div>

    <div class="landing-content">
      <div class="wrapper">
        <%= yield %>
      </div>
    </div>


    <% if @show_after_black_bar_border %>
      <div class="after-black-bar-border"></div>
    <% end %>

    <div class="wrapper after-black-bar">
      <%= yield(:after_black_bar) %>
    </div>

    <div class="white-bar">
      <div class="wrapper">
      <%= yield(:white_bar) %>
      </div>
    </div>

    <div class="red-bar">
      <div class="wrapper">
        <%= yield(:red_bar) %>
      </div>
    </div>


    <div id="footer-container">
      <%= render "clients/footer" %>
    </div>

    <%= render "clients/jamServer" %>
    <%= render "clients/notify" %>
    <%= render "clients/hoverMusician" %>
    <%= render "clients/hoverFan" %>
    <%= render "clients/hoverBand" %>
    <%= render "clients/hoverSession" %>
    <%= render "clients/hoverRecording" %>
    <%= render "clients/help" %>
    <%= render "clients/listenBroadcast" %>
    <%= render "clients/flash" %>
    <%= render "clients/jam_track_preview" %>
    <%= render "clients/help" %>
    <%= render "clients/lessonSessionActions" %>
    <%= render "clients/jamblasterOptions" %>
    <%= render "clients/manageVsts" %>
    <%= render 'dialogs/dialogs' %>

    <script type="text/javascript">
      JK = JK || {};

      JK.root_url = "<%= root_url %>"

      <% if current_user %>
      JK.currentUserId = '<%= current_user.id %>';
      JK.currentUserAvatarUrl = JK.resolveAvatarUrl('<%= current_user.photo_url %>');
      JK.currentUserName = '<%= current_user.name %>';
      JK.currentUserMusician = '<%= current_user.musician %>';
      JK.currentUserFreeJamTrack = <%= current_user.show_free_jamtrack? %>
      <% else %>
      JK.currentUserId = null;
      JK.currentUserAvatarUrl = null;
      JK.currentUserName = null;
      JK.currentUserMusician = null;
      JK.currentUserFreeJamTrack = <%= anonymous_user.nil? ?  false : anonymous_user.show_free_jamtrack? %>
      <% end %>
    </script>

    <script type="text/javascript">
        $(function () {

            JK.app = JK.JamKazam();

            var jamServer = new JK.JamServer(JK.app, $.noop);
            jamServer.initialize();

            JK.app.initialize({inClient: false, layoutOpts: {layoutFooter: false, sizeOverlayToContent: true}});

            var signupDialog = new JK.SignupDialog(JK.app);
            signupDialog.initialize();

            var signinDialog = new JK.SigninDialog(JK.app);
            signinDialog.initialize();

            JK.bindHoverEvents();

            JK.getGenreList().done(function(genres) {
              JK.genres = genres;
            });

            AppActions.appInit.trigger(JK.app)

            JK.JamServer.connect() // singleton here defined in JamServer.js
                .done(function() {
                  console.log("websocket connected")
                })
                .fail(function() {
                  //console.log("websocket failed to connect")
                });
        })
    </script>

    <%= yield(:extra_js) %>


    <%= render "shared/ga" %>
    <%= render "shared/twttr" %>
    <%= render "shared/facebook_sdk" %>
    <%= render "shared/google_nocaptcha" %>
    <%= render "shared/olark" %>
    <!-- version: <%= version %> -->
  </body>
</html>
