<!--<div class="focus">
	<div class="focusleft">
		<p># of Topics: <%= @map.topics.count %></p>
		<p># of Synapses: <%= @map.synapses.count %></p>
		<% if (@map.permission == "commons" && authenticated?) || @map.user == user %>
			<%= form_for @map, :url => savelayout_path(@map), :html => { :class => "saveMapLayout", :id => "saveMapLayout"}, remote: true do |form| %>
				<%= form.hidden_field "coordinates", :value => "" %>
				<%= form.submit "Save Layout", class: "saveLayout", id: "saveLayout" %>
			<% end %>
		<% end %>
    <button onclick="if (!goRealtime) { this.innerHTML = 'Stop Realtime'; $('#saveLayout').css('display','none');} else if (goRealtime) { this.innerHTML = 'Start Realtime'; $('#saveLayout').css('display','block');} goRealtime = !goRealtime;">Start Realtime</button>
	</div>
	<div class="focusmiddle">
		<h1 class="title"><%= @map.name %> <% if (@map.permission == "commons" && authenticated?) || @map.user == user %><%= link_to "[edit]", edit_map_path(@map) %><% end %></h1>
		<div class="desc">
			<p><%= @map.desc %></p>
		</div>
	</div>
	<div class="focusright">
		<div class="link"><p>Permissions: <%= @map.permission %></p></div>
	</div>
</div>
<div class="clearfloat nodemargin"></div>-->

<div class="headertop">
    <button onclick="if (!goRealtime) { this.innerHTML = 'Stop Realtime'; $('#saveLayout').css('display','none');} else if (goRealtime) { this.innerHTML = 'Start Realtime'; $('#saveLayout').css('display','block');} goRealtime = !goRealtime;">Start Realtime</button>
    <button onclick="hideSelectedEdges();hideSelectedNodes();">Hide Selected</button>
    <% if authenticated? %>
      <button onclick="removeSelectedEdges();removeSelectedNodes();">Remove Selected From Map</button>
      <button onclick="var r=confirm('Are you sure you want to permanently delete selected objects?!'); if (r == true) {deleteSelectedEdges();deleteSelectedNodes();}">Permanently Delete Selected</button>
      <% if (@map.permission == "commons" && authenticated?) || @map.user == user %>
			  <%= form_for @map, :url => savelayout_path(@map), :html => { :class => "saveMapLayout", :id => "saveMapLayout"}, remote: true do |form| %>
				  <%= form.hidden_field "coordinates", :value => "" %>
				  <%= form.submit "Save Layout", class: "saveLayout", id: "saveLayout" %>
			  <% end %>
		  <% end %>
      <button onclick="saveToMap();">Save to New Map</button>
    <% end %>
    <button onclick='clearCanvas();'>Clear Canvas</button>
</div>
<div class="clearfloat"></div>

<h1 class="index">
  <% if (@map.permission == "commons" && authenticated?) || @map.user == user %>
    Editing Map:
  <% else %>
    Viewing Map:  
  <% end %>
  <%= @map.name %>
</h1>

<div class="maps onMap" id="container">
  <div id="center-container">
    <div id="infovis"></div>    
  </div>
</div>
<div class="clearfloat"></div>

<% if authenticated? %>
  <%= render :partial => 'newtopic' %>
  <%= render :partial => 'newsynapse' %>
  <%= render :partial => 'maps/new' %>
<% end %>
<%= form_for @map, :url => realtime_path(@map), :method => "GET", :html => { :id => "MapRealtime"}, remote: true do |form| %>
  <%= form.hidden_field :time, :value => Time.now.to_i %>
  <%= form.hidden_field :ids, :value => 0 %>
<% end %>
<script>
  var dragged = 0;
  mapid = <%= @map.id %>;
  var int = setInterval(function(){
      if (goRealtime) {
        $('#MapRealtime').submit();
      }
    },4000);
</script>

<script>
  viewMode = "graph";
	json = <%= @mapjson %>;
	if (json.length > 0) {
		$(document).ready(function() {
			<% if (@map.arranged) %>
				initialize("arranged");
			<% else %>
				initialize("chaotic");
			<% end %>
		});
	}
  else {
		$(document).ready(function() {
				initialize("chaotic", true);
		});
	}
</script>

<%= render :partial => 'main/find' %>
<%= render :partial => 'main/analyze' %>
<%= render :partial => 'main/organize' %>