$(function() {
  $(".spec-table").live('click', function() {
    lightsOut();
    
    $.getScript();
    
    return false;
  });
  
  $(".lightsOn").live("click", function() {
    lightsOn();
    
    return false;
  });
});

// Dim the background
function lightsOut() {
  $('<div id="specTableContainer"></div>').insertBefore("#pageWrapper");
  $('<div id="lightsOut"></div>').insertBefore("#pageWrapper");
  
  $.get("core-technologies-table.html", function(result){
    $("#specTableContainer").html(result);
  });
  
  // Add an event listener on the ESC key to call lightsOn()
  $(document).keydown(function(event) {
    if(event.keyCode == '27') {
      lightsOn();
      event.preventDefault();
    }
  });
}

// Remove the lightsOut div
function lightsOn() {
  $("#lightsOut").remove();
  $("#specTableContainer").remove();
}

