var LAST_LOG_MESSAGE = "";

$(document).ready(function () {
  $(".grid_entity").mouseenter(function () {
    displayEventInfo($(this)[0].id, "image_");
  });
  $(".grid_entity").mouseleave(function () {
    displayEventInfo($(this)[0].id, "image_");
  });
});

function displayEventInfo(id, prefix){
  var img_id = id.substr(prefix.length);
  $("#hover_" + img_id).toggleClass("invisible");
  $("#card_" + img_id).toggleClass("invisible");
}

function logToConsole(text_to_log){
  var default_padding = '<br>';
  var duplicate = '+';
  var padding = default_padding;
  if(text_to_log == LAST_LOG_MESSAGE){
    padding = duplicate;
  }
  document.getElementById('console').innerHTML += text_to_log + padding;
  LAST_LOG_MESSAGE = text_to_log;
}
