<!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    "basic/basic", media: "all" %>
  <%= include_gon(:init => true) %>
  <%= csrf_meta_tags %>
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <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" %>
</head>
<body class="basic <%= yield(:page_name) %>">
<div id="basic-container">
  <%=  javascript_include_tag "basic/basic" %>
  <div class="wrapper">
    <%= yield %>
  </div>
</div>
<%= render "clients/jamServer" %>
<%= render "clients/help" %>
<%= render 'dialogs/banner' %>
<%= render 'dialogs/banners/disconnected' %>


<script type="text/javascript">
  $(function () {
    JK = JK || {};

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

    JK.app = JK.JamKazam();

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

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

    <% if current_user %>
    JK.currentUserId = '<%= current_user.id %>';
    JK.currentUserAvatarUrl = JK.resolveAvatarUrl('<%= current_user.photo_url %>');
    JK.currentUserName = '<%= current_user.name %>';
    <% else %>
    JK.currentUserId = null;
    JK.currentUserAvatarUrl = null;
    JK.currentUserName = null;
    <% end %>


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

    <% end %>
  })
</script>

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