$(document).ready(function(){
      
  $(".ui-button").hover(
    function(){ $(this).addClass("ui-state-hover"); },
    function(){ $(this).removeClass("ui-state-hover"); }
  );

  var host = window.location.host.toLowerCase();
  $("a[href^='http:']").not("[href*='"+host+"']").attr('target','_blank');

  if ($("#surveyData").length) {
  
    $("#surveyDataContainer").height("100%");

    $("#surveyData").height("98%");

    $("#surveyCloseButton").click(function(e) {
      e.preventDefault();
      $("#surveyDataContainer").hide();
    });

    $.getJSON("/survey/surveys", function(response) {
      var data = {
        rows: response,
        cols: [{label: 'Last Modified', type: 'string'},
          {label: 'Gender', type: 'string'},
          {label: 'Age', type: 'string'},
          {label: 'Disorder(s)', type: 'string'},
          {label: 'Date of Onset', type: 'string'},
          {label: 'Date of Diagnosis', type: 'string'},
          {label: 'Pain Levels(Low/Hi)', type: 'string'},
          {label: 'HLA b27', type: 'string'},
          {label: 'Current Treatment(s)', type: 'string'},
          {label: 'Disability', type: 'string'},
          {label: 'Symptoms', type: 'string'}
        ]
      };

      var dt = new google.visualization.DataTable();

      $.each(data.cols, function(i, col) {
        dt.addColumn(col.type, col.label);
      });

      dt.addRows(data.rows);

      var table = new google.visualization.Table(document.getElementById('surveyData'));
      table.draw(dt, {showRowNumber: true, width: '1650px'});
    });
  }
});